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
28OMStatus onert_micro::import::configure_kernel_CirclePack(const OMConfigureArgs &config_args)
29{
30 OMRuntimeContext &runtime_context = config_args.runtime_context;
31 uint16_t op_index = config_args.kernel_index;
32
34
35 OMStatus status = runtime_kernel.readKernel(op_index, runtime_context);
36 if (status != Ok)
37 return status;
38
39 const int num_inputs = runtime_kernel.inputs_num;
40
41 const auto *t0 = runtime_kernel.inputs[0];
42 const auto *output = runtime_kernel.outputs[0];
43
44 if (output->type() != t0->type())
46
47 const auto *params = runtime_kernel.first_operator->builtin_options_as_PackOptions();
48
49 OMRuntimeShape input_shape(t0);
50 int axis = params->axis();
51 if (axis < 0)
52 axis += input_shape.dimensionsCount();
53
54 if (axis < 0 or axis > input_shape.dimensionsCount())
56
57 for (int i = 1; i < num_inputs; ++i)
58 {
59 const auto *tensor = runtime_kernel.inputs[i];
60 if (tensor->type() != t0->type())
62 }
63
64 return Ok;
65}
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]
@ FailedCheckCondition
Definition OMStatus.h:32