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
37OMStatus onert_micro::execute::execute_kernel_CircleLessEqual(const OMExecuteArgs &execute_args)
38{
39 core::OMRuntimeContext &runtime_context = execute_args.runtime_context;
40 core::OMRuntimeStorage &runtime_storage = execute_args.runtime_storage;
41 uint16_t op_index = execute_args.kernel_index;
42
43 OMStatus status = Ok;
44
45 const circle::Tensor *input1 = nullptr;
46 const circle::Tensor *input2 = nullptr;
47 const circle::Tensor *output = nullptr;
48
49 OMRuntimeKernel runtime_kernel;
50 runtime_kernel.readKernel(op_index, runtime_context);
51
52 status = runtime_kernel.getDataFromStorage(op_index, runtime_storage, runtime_context);
53 if (status != Ok)
54 return status;
55
56 input1 = runtime_kernel.inputs[input1TensorIdx];
57 input2 = runtime_kernel.inputs[input2TensorIdx];
58 output = runtime_kernel.outputs[outputTensorIdx];
59
60 assert(input1 != nullptr);
61 assert(input2 != nullptr);
62 assert(output != nullptr);
63
64 switch (input1->type())
65 {
66 case circle::TensorType_INT64:
67 onert_micro::execute::evalComparisonGeneric<int64_t>(&runtime_kernel,
69 break;
70 case circle::TensorType_INT32:
71 onert_micro::execute::evalComparisonGeneric<int32_t>(&runtime_kernel,
73 break;
74
75#ifndef DIS_FLOAT
76 case circle::TensorType_FLOAT32:
77 onert_micro::execute::evalComparisonGeneric<float>(&runtime_kernel,
79 break;
80#endif // DIS_FLOAT
81 default:
82 assert(false && "Unsupported type.");
83 }
84
85 return status;
86}
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)
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage