ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Equal.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "Builders.h"
18#include "ComparisonCommon.h"
19#include "TISOKernel.h"
20
21namespace luci_interpreter
22{
23
24void configure_kernel_CircleEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
25{
26 kernels::TISOKernel kernel(cur_op, runtime_graph);
27
28 LUCI_INTERPRETER_CHECK(Tensor::element_type(kernel.input1()) ==
29 Tensor::element_type(kernel.input2()));
30 LUCI_INTERPRETER_CHECK(Tensor::element_type(kernel.output()) == DataType::BOOL);
31}
32
33void execute_kernel_CircleEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
34{
35 kernels::TISOKernel kernel(cur_op, runtime_graph);
36
37 switch (Tensor::element_type(kernel.input1()))
38 {
39 case DataType::S64:
40 kernels::evalComparisonGeneric<int64_t>(kernel.input1(), kernel.input2(), kernel.output(),
41 runtime_graph, luci_interpreter_pal::EqualFn);
42 break;
43 case DataType::S32:
44 kernels::evalComparisonGeneric<int32_t>(kernel.input1(), kernel.input2(), kernel.output(),
45 runtime_graph, luci_interpreter_pal::EqualFn);
46 break;
47#ifndef DIS_FLOAT
48 case DataType::FLOAT32:
49 kernels::evalComparisonGeneric<float>(kernel.input1(), kernel.input2(), kernel.output(),
50 runtime_graph, luci_interpreter_pal::EqualFn);
51 break;
52#endif // DIS_FLOAT
53 default:
54 assert(false && "Unsupported type.");
55 }
56}
57
58} // namespace luci_interpreter
const circle::Tensor * output() const
Definition TISOKernel.h:62
const circle::Tensor * input2() const
Definition TISOKernel.h:61
const circle::Tensor * input1() const
Definition TISOKernel.h:60
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36
bool EqualFn(T lhs, T rhs)
void configure_kernel_CircleEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
Definition Equal.cpp:24
void execute_kernel_CircleEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
Definition Equal.cpp:33