ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Pack.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 "OMStatus.h"
18
19#include "core/OMDataType.h"
20#include "core/OMUtils.h"
21
24
25using namespace onert_micro;
26using namespace onert_micro::core;
27
28namespace onert_micro
29{
30namespace import
31{
32
34{
35 OMRuntimeContext &runtime_context = config_args.runtime_context;
36 uint16_t op_index = config_args.kernel_index;
37
39
40 OMStatus status = runtime_kernel.readKernel(op_index, runtime_context);
41 if (status != Ok)
42 return status;
43
44 const int num_inputs = runtime_kernel.inputs_num;
45
46 const auto *t0 = runtime_kernel.inputs[0];
47 const auto *output = runtime_kernel.outputs[0];
48
49 if (output->type() != t0->type())
51
52 const auto *params = runtime_kernel.first_operator->builtin_options_as_PackOptions();
53
54 OMRuntimeShape input_shape(t0);
55 int axis = params->axis();
56 if (axis < 0)
57 axis += input_shape.dimensionsCount();
58
59 if (axis < 0 or axis > input_shape.dimensionsCount())
61
62 for (int i = 1; i < num_inputs; ++i)
63 {
64 const auto *tensor = runtime_kernel.inputs[i];
65 if (tensor->type() != t0->type())
67 }
68
69 return Ok;
70}
71
72} // namespace import
73} // namespace onert_micro
size_t dimensionsCount() const noexcept
const circle::Operator * first_operator
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
OMStatus configure_kernel_CirclePack(const OMConfigureArgs &config_args)
Definition Pack.cpp:33
@ FailedCheckCondition
Definition OMStatus.h:32
core::OMRuntimeContext & runtime_context