ONE - On-device Neural Engine
Loading...
Searching...
No Matches
LessEqual.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 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
18#include "OMStatus.h"
20#include "core/OMUtils.h"
22#include "PALComparisons.h"
23
24using namespace onert_micro;
25using namespace onert_micro::core;
26using namespace onert_micro::execute;
27
28namespace
29{
30
31constexpr uint32_t input1TensorIdx = 0;
32constexpr uint32_t input2TensorIdx = 1;
33constexpr uint32_t outputTensorIdx = 0;
34
35} // namespace
36
37namespace onert_micro
38{
39namespace execute
40{
41
43{
44 core::OMRuntimeContext &runtime_context = execute_args.runtime_context;
45 core::OMRuntimeStorage &runtime_storage = execute_args.runtime_storage;
46 uint16_t op_index = execute_args.kernel_index;
47
48 OMStatus status = Ok;
49
50 const circle::Tensor *input1 = nullptr;
51 const circle::Tensor *input2 = nullptr;
52 const circle::Tensor *output = nullptr;
53
54 OMRuntimeKernel runtime_kernel;
55 runtime_kernel.readKernel(op_index, runtime_context);
56
57 status = runtime_kernel.getDataFromStorage(op_index, runtime_storage, runtime_context);
58 if (status != Ok)
59 return status;
60
61 input1 = runtime_kernel.inputs[input1TensorIdx];
62 input2 = runtime_kernel.inputs[input2TensorIdx];
63 output = runtime_kernel.outputs[outputTensorIdx];
64
65 assert(input1 != nullptr);
66 assert(input2 != nullptr);
67 assert(output != nullptr);
68
69 switch (input1->type())
70 {
71 case circle::TensorType_INT64:
72 onert_micro::execute::evalComparisonGeneric<int64_t>(&runtime_kernel,
74 break;
75 case circle::TensorType_INT32:
76 onert_micro::execute::evalComparisonGeneric<int32_t>(&runtime_kernel,
78 break;
79
80#ifndef DIS_FLOAT
81 case circle::TensorType_FLOAT32:
82 onert_micro::execute::evalComparisonGeneric<float>(&runtime_kernel,
84 break;
85#endif // DIS_FLOAT
86 default:
87 assert(false && "Unsupported type.");
88 }
89
90 return status;
91}
92
93} // namespace execute
94} // namespace onert_micro
OMStatus getDataFromStorage(uint16_t op_index, core::OMRuntimeStorage &storage, core::OMRuntimeContext &context)
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
constexpr uint32_t input1TensorIdx
constexpr uint32_t outputTensorIdx
constexpr uint32_t input2TensorIdx
bool LessEqualFn(T lhs, T rhs)
OMStatus execute_kernel_CircleLessEqual(const OMExecuteArgs &execute_args)
Definition LessEqual.cpp:42
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage