ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Maximum.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 "core/OMUtils.h"
19#include "OMStatus.h"
21
22using namespace onert_micro;
23using namespace onert_micro::core;
24
25namespace
26{
27
28constexpr uint32_t input1TensorIdx = 0;
29constexpr uint32_t input2TensorIdx = 1;
30constexpr uint32_t outputTensorIdx = 0;
31
32} // namespace
33
34namespace onert_micro
35{
36namespace import
37{
38
40{
41
42 OMRuntimeContext &runtime_context = config_args.runtime_context;
43 uint16_t op_index = config_args.kernel_index;
44
46
47 OMStatus status = runtime_kernel.readKernel(op_index, runtime_context);
48 if (status != Ok)
49 return status;
50
51 const circle::Tensor *input1 = runtime_kernel.inputs[input1TensorIdx];
52 const circle::Tensor *input2 = runtime_kernel.inputs[input2TensorIdx];
53 const circle::Tensor *output = runtime_kernel.outputs[outputTensorIdx];
54
55 assert(input1 != nullptr);
56 assert(input2 != nullptr);
57 assert(output != nullptr);
58
59 status = utils::checkCondition(input1->type() == input2->type());
60 if (status != Ok)
61 return status;
62
63 status = utils::checkCondition(input1->type() == output->type());
64 if (status != Ok)
65 return status;
66
67 return status;
68}
69
70} // namespace import
71} // namespace onert_micro
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
OMStatus configure_kernel_CircleMaximum(const OMConfigureArgs &config_args)
Definition Maximum.cpp:39
core::OMRuntimeContext & runtime_context