ONE - On-device Neural Engine
Loading...
Searching...
No Matches
OMUtils.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
17#include "import/OMUtils.h"
18#include <cmath>
19
20using namespace onert_micro::execute;
21using namespace onert_micro;
22
24 const circle::Tensor **input,
25 const circle::Tensor **output)
26{
27 OMStatus status;
28
29 core::OMRuntimeContext &runtime_context = execute_args.runtime_context;
30 core::OMRuntimeStorage &runtime_storage = execute_args.runtime_storage;
31 uint16_t op_index = execute_args.kernel_index;
32
33 OMRuntimeKernel runtime_kernel;
34 status = runtime_kernel.readKernel(op_index, runtime_context);
35
36 *input = runtime_kernel.inputs[0];
37 *output = runtime_kernel.outputs[0];
38
39 assert(*input != nullptr);
40 assert(*output != nullptr);
41
42 return status;
43}
44
46 const circle::Tensor **input1,
47 const circle::Tensor **input2,
48 const circle::Tensor **output)
49{
50 OMStatus status;
51
52 core::OMRuntimeContext &runtime_context = execute_args.runtime_context;
53 core::OMRuntimeStorage &runtime_storage = execute_args.runtime_storage;
54 uint16_t op_index = execute_args.kernel_index;
55
56 OMRuntimeKernel runtime_kernel;
57 status = runtime_kernel.readKernel(op_index, runtime_context);
58
59 *input2 = runtime_kernel.inputs[0];
60 *input1 = runtime_kernel.inputs[1];
61 *output = runtime_kernel.outputs[0];
62
63 assert(*input1 != nullptr);
64 assert(*input2 != nullptr);
65 assert(*output != nullptr);
66
67 return status;
68}
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
OMStatus TISOHeader(const OMConfigureArgs &execute_args, const circle::Tensor **input1, const circle::Tensor **input2, const circle::Tensor **output)
Definition OMUtils.cpp:45
OMStatus SISOHeader(const OMConfigureArgs &execute_args, const circle::Tensor **input, const circle::Tensor **output)
Definition OMUtils.cpp:23
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage