ONE - On-device Neural Engine
Loading...
Searching...
No Matches
NotEqual.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_CircleNotEqual(const circle::Operator *cur_op,
25 BaseRuntimeGraph *runtime_graph)
26{
27 kernels::TISOKernel kernel(cur_op, runtime_graph);
28
29 LUCI_INTERPRETER_CHECK(Tensor::element_type(kernel.input1()) ==
30 Tensor::element_type(kernel.input2()));
31 LUCI_INTERPRETER_CHECK(Tensor::element_type(kernel.output()) == DataType::BOOL);
32}
33
34void execute_kernel_CircleNotEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
35{
36 kernels::TISOKernel kernel(cur_op, runtime_graph);
37
38 switch (Tensor::element_type(kernel.input1()))
39 {
40 case DataType::S64:
41 kernels::evalComparisonGeneric<int64_t>(kernel.input1(), kernel.input2(), kernel.output(),
43 break;
44 case DataType::S32:
45 kernels::evalComparisonGeneric<int32_t>(kernel.input1(), kernel.input2(), kernel.output(),
47 break;
48#ifndef DIS_FLOAT
49 case DataType::FLOAT32:
50 kernels::evalComparisonGeneric<float>(kernel.input1(), kernel.input2(), kernel.output(),
52 break;
53#endif // DIS_FLOAT
54 default:
55 assert(false && "Unsupported type.");
56 }
57}
58
59} // 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 NotEqualFn(T lhs, T rhs)
void configure_kernel_CircleNotEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
Definition NotEqual.cpp:24
void execute_kernel_CircleNotEqual(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
Definition NotEqual.cpp:34