diff options
Diffstat (limited to 'onert-micro/luci-interpreter/src/loader')
81 files changed, 113 insertions, 3413 deletions
diff --git a/onert-micro/luci-interpreter/src/loader/GraphLoader.cpp b/onert-micro/luci-interpreter/src/loader/GraphLoader.cpp index cb9dd7fea..26e207ac0 100644 --- a/onert-micro/luci-interpreter/src/loader/GraphLoader.cpp +++ b/onert-micro/luci-interpreter/src/loader/GraphLoader.cpp @@ -21,38 +21,62 @@ namespace luci_interpreter namespace { -// TODO: add more operations -bool isCouldBeEmplaceOperation(circle::BuiltinOperator op) +bool isInplaceOperation(const circle::BuiltinOperator &op) { switch (op) { + case circle::BuiltinOperator_ABS: case circle::BuiltinOperator_LOGISTIC: case circle::BuiltinOperator_RESHAPE: + case circle::BuiltinOperator_ELU: case circle::BuiltinOperator_EXPAND_DIMS: + case circle::BuiltinOperator_EXP: + case circle::BuiltinOperator_TANH: + case circle::BuiltinOperator_LEAKY_RELU: + case circle::BuiltinOperator_RELU: + case circle::BuiltinOperator_RELU6: + case circle::BuiltinOperator_ADD: + case circle::BuiltinOperator_MUL: + case circle::BuiltinOperator_SUB: + case circle::BuiltinOperator_WHILE: return true; default: return false; } } -bool isCouldBeEmplaceTensor(CircleReader *reader, const int32_t tensor_index) +bool isSingleUsageOfTensor(CircleReader *reader, const int32_t tensor_index) { uint32_t usage_count = 0; - for (uint32_t i = 0; i < reader->operators().size(); ++i) + + const auto operators = reader->operators(); + for (uint32_t i = 0; i < operators.size(); ++i) { - const auto op = reader->operators().at(i); + const auto *op = operators.at(i); assert(op != nullptr); - for (int32_t j = 0; j < op->inputs()->size(); ++j) + const auto *op_inputs = op->inputs(); + for (int32_t j = 0; j < op_inputs->size(); ++j) { - const auto input_index = op->inputs()->operator[](j); + const auto input_index = op_inputs->operator[](j); if (input_index == tensor_index) - usage_count++; - - if (usage_count > 1) - return false; + { + if (++usage_count > 1) + return false; + } } } + + // Let's check that it is not graph output + if (usage_count == 1) + { + const auto &outputs_indexes = reader->outputs(); + bool is_graph_output = (std::find(outputs_indexes.begin(), outputs_indexes.end(), + tensor_index) != outputs_indexes.end()); + if (is_graph_output) + return false; + } + return true; } @@ -60,29 +84,83 @@ bool isCouldBeEmplaceTensor(CircleReader *reader, const int32_t tensor_index) void GraphLoader::checkInplaceOps(CircleReader *reader, RuntimeGraph *runtime_graph) { - for (uint32_t i = 0; i < reader->operators().size(); ++i) + const auto operators = reader->operators(); + const auto graph_outputs = reader->outputs(); + for (uint32_t i = 0; i < operators.size(); ++i) { - const auto *op = reader->operators().at(i); + const auto *op = operators.at(i); assert(op != nullptr); - bool is_graph_input = false; - for (int32_t j = 0; j < op->inputs()->size(); ++j) + // Check inplace optimization for operation with single input and single output + if (isInplaceOperation(reader->builtin_code(op))) { - const auto input_index = op->inputs()->operator[](j); - if (input_index == -1) - continue; + const auto *op_inputs = op->inputs(); + const auto *op_outputs = op->outputs(); - const auto &inputs_indexes = reader->inputs(); + bool is_inplace = true; + auto non_const_input_it = op_inputs->begin(); + while (true) + { + non_const_input_it = + std::find_if(non_const_input_it, op_inputs->end(), [&reader](const auto input_idx) { + if (input_idx == -1) + return false; - is_graph_input = (std::find(inputs_indexes.begin(), inputs_indexes.end(), input_index) != - inputs_indexes.end()) or - is_graph_input; + return not Tensor::is_constant_tensor(reader, reader->tensors()[input_idx]); + }); - if (not is_graph_input and isCouldBeEmplaceOperation(reader->builtin_code(op)) and - op->outputs()->size() == 1 and isCouldBeEmplaceTensor(reader, input_index)) - { - runtime_graph->addInplaceOpIndex(i); + if (non_const_input_it == op_inputs->end()) + break; + + auto dist = std::distance(op_inputs->begin(), non_const_input_it); + + const auto non_const_input_idx = *non_const_input_it; + + // Check single usage of input tensor + if (not isSingleUsageOfTensor(reader, non_const_input_idx)) + { + is_inplace = false; + break; + } + + // Let's check single usage of output tensor + if (dist >= op_outputs->size() and op_outputs->size() == 1) + dist = 0; + assert(dist < op_outputs->size()); + const auto output_index = op_outputs->operator[](dist); + if (not isSingleUsageOfTensor(reader, output_index)) + { + is_inplace = false; + break; + } + + // Check that num elements are equal + { + const auto *input_non_const_tensor = reader->tensors().at(non_const_input_idx); + const auto *output_tensor = reader->tensors().at(output_index); + if (Tensor::num_elements(input_non_const_tensor) != Tensor::num_elements(output_tensor)) + { + is_inplace = false; + break; + } + } + + // Let's check that output is not a graph output tensor + // TODO: check this statement + { + if (std::find(graph_outputs.begin(), graph_outputs.end(), output_index) != + graph_outputs.end()) + { + is_inplace = false; + break; + } + } + + non_const_input_it++; } + + if (is_inplace) + runtime_graph->addInplaceOpIndex(op); } } } diff --git a/onert-micro/luci-interpreter/src/loader/ModuleLoader.cpp b/onert-micro/luci-interpreter/src/loader/ModuleLoader.cpp index 0bb38c604..dcfa32983 100644 --- a/onert-micro/luci-interpreter/src/loader/ModuleLoader.cpp +++ b/onert-micro/luci-interpreter/src/loader/ModuleLoader.cpp @@ -22,7 +22,7 @@ namespace luci_interpreter { void ModuleLoader::load(RuntimeModule *runtime_module, SimpleMemoryManager *memory_manager, - const char *model_data_raw) + const char *model_data_raw, bool dealloc_input) { const circle::Model *model = circle::GetModel(model_data_raw); @@ -32,19 +32,16 @@ void ModuleLoader::load(RuntimeModule *runtime_module, SimpleMemoryManager *memo for (size_t i = 0; i < reader.num_subgraph(); ++i) { + if (!reader.select_subgraph(i)) + assert(false && "Error during select subgraph"); runtime_module->addGraph(memory_manager); - } #ifndef USE_STATIC_ALLOC - for (size_t i = 0; i < reader.num_subgraph(); ++i) - { - if (!reader.select_subgraph(i)) - assert(false && "Error during select subgraph"); auto *runtime_graph = runtime_module->getRuntimeGraphAt(i); // For Dynamic memory manager we can use inplace optimization GraphLoader::checkInplaceOps(&reader, runtime_graph); - } #endif // USE_STATIC_ALLOC + } // For Dynamic Memory manager we build memory allocate/deallocate plan and then configure kernels. // For Static Memory manager we only configure kernels. @@ -54,9 +51,12 @@ void ModuleLoader::load(RuntimeModule *runtime_module, SimpleMemoryManager *memo #ifdef USE_STATIC_ALLOC runtime_graph->configure_kernels(); #else - runtime_graph->configure(); + runtime_graph->configure(dealloc_input); #endif // USE_STATIC_ALLOC } + + // Select main subgraph + reader.select_subgraph(0); } } // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/ModuleLoader.h b/onert-micro/luci-interpreter/src/loader/ModuleLoader.h index c35c72da9..bfe3e7076 100644 --- a/onert-micro/luci-interpreter/src/loader/ModuleLoader.h +++ b/onert-micro/luci-interpreter/src/loader/ModuleLoader.h @@ -29,7 +29,7 @@ class ModuleLoader { public: static void load(RuntimeModule *runtime_module, MemoryManager *memory_manager, - const char *model_data_raw); + const char *model_data_raw, bool dealloc_input); }; } // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Add.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Add.cpp deleted file mode 100644 index 2a2140b0f..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Add.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Add.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleAdd(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsAddOptions(); - - AddParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::Add>(input1, input2, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/ArgMax.cpp b/onert-micro/luci-interpreter/src/loader/nodes/ArgMax.cpp deleted file mode 100644 index 0da72daab..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/ArgMax.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/ArgMax.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleArgMax(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *axis = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsArgMaxOptions(); - - ArgMaxParams params{}; - params.output_type = static_cast<DataType>(options->output_type); - - return std::make_unique<kernels::ArgMax>(input, axis, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/AveragePool2D.cpp b/onert-micro/luci-interpreter/src/loader/nodes/AveragePool2D.cpp deleted file mode 100644 index 9a5af1c37..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/AveragePool2D.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/AveragePool2D.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleAveragePool2D(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsPool2DOptions(); - - Pool2DParams params{}; - params.padding = luci_padding(options->padding); - params.filter_height = options->filter_height; - params.filter_width = options->filter_width; - params.stride_height = options->stride_h; - params.stride_width = options->stride_w; - params.activation = luci_actfunc(options->fused_activation_function); - - // It is unknown what data will be stored in scratchpad tensor, - // using UINT8 as a most general option - auto scratchpad = std::make_unique<Tensor>(DataType::U8, Shape({}), nullptr); - scratchpad->set_data_buffer(nullptr); - // TODO move tensors offset initialization to one place - // TODO handle with static manager - Tensor *tmp = builder.get_runtime_graph()->addTensor(std::move(scratchpad)); - - return std::make_unique<kernels::AveragePool2D>(input, output, tmp, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/BatchMatMul.cpp b/onert-micro/luci-interpreter/src/loader/nodes/BatchMatMul.cpp deleted file mode 100644 index 7799331d6..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/BatchMatMul.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/BatchMatMul.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleBatchMatMul(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *lhs = inputs.at(0); - const Tensor *rhs = inputs.at(1); - Tensor *output = outputs.at(0); - - auto lhs_scratchpad = std::make_unique<Tensor>(lhs->element_type(), Shape({}), nullptr); - lhs_scratchpad->set_data_buffer(nullptr); - auto rhs_scratchpad = std::make_unique<Tensor>(rhs->element_type(), Shape({}), nullptr); - rhs_scratchpad->set_data_buffer(nullptr); - // TODO move tensors offset initialization to one place - // TODO handle with StaticManager - Tensor *lhs_tmp = builder.get_runtime_graph()->addTensor(std::move(lhs_scratchpad)); - Tensor *rhs_tmp = builder.get_runtime_graph()->addTensor(std::move(rhs_scratchpad)); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsBatchMatMulOptions(); - - BatchMatMulParams params; - params.adj_x = options->adjoint_lhs; - params.adj_y = options->adjoint_rhs; - - return std::make_unique<kernels::BatchMatMul>(lhs, rhs, output, lhs_tmp, rhs_tmp, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/BatchToSpaceND.cpp b/onert-micro/luci-interpreter/src/loader/nodes/BatchToSpaceND.cpp deleted file mode 100644 index 424844a3c..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/BatchToSpaceND.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/BatchToSpaceND.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleBatchToSpaceND(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *block_shape = inputs.at(1); - const Tensor *crops = inputs.at(2); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::BatchToSpaceND>(input, block_shape, crops, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Cast.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Cast.cpp deleted file mode 100644 index 441dacbc6..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Cast.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Cast.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleCast(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Cast>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Concatenation.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Concatenation.cpp deleted file mode 100644 index e2b847a3a..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Concatenation.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Concatenation.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleConcatenation(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - std::vector<const Tensor *> input_tensors(inputs.size()); - for (uint32_t i = 0; i < inputs.size(); ++i) - { - input_tensors[i] = inputs.at(i); - } - Tensor *output = outputs.at(0); - ; - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsConcatenationOptions(); - - ConcatenationParams params{}; - params.axis = options->axis; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::Concatenation>(std::move(input_tensors), output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Conv2D.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Conv2D.cpp deleted file mode 100644 index 1750e8afc..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Conv2D.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Conv2D.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleConv2D(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *filter = inputs.at(1); - const Tensor *bias = inputs.at(2); - Tensor *output = outputs.at(0); - - // It is unknown what data will be stored in scratchpad tensor, - // using UINT8 as a most general option - auto scratchpad = std::make_unique<Tensor>(DataType::U8, Shape({}), nullptr); - scratchpad->set_data_buffer(nullptr); - // TODO move tensors offset initialization to one place - // TODO handle with StaticManager - Tensor *tmp = builder.get_runtime_graph()->addTensor(std::move(scratchpad)); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsConv2DOptions(); - - Conv2DParams params{}; - params.padding = luci_padding(options->padding); - params.stride_height = options->stride_h; - params.stride_width = options->stride_w; - params.dilation_height_factor = options->dilation_h_factor; - params.dilation_width_factor = options->dilation_w_factor; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::Conv2D>(input, filter, bias, output, tmp, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/DepthToSpace.cpp b/onert-micro/luci-interpreter/src/loader/nodes/DepthToSpace.cpp deleted file mode 100644 index ebab0ccec..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/DepthToSpace.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/DepthToSpace.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleDepthToSpace(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsDepthToSpaceOptions(); - - DepthToSpaceParams params{}; - params.block_size = options->block_size; - - return std::make_unique<kernels::DepthToSpace>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/DepthwiseConv2D.cpp b/onert-micro/luci-interpreter/src/loader/nodes/DepthwiseConv2D.cpp deleted file mode 100644 index cebad555a..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/DepthwiseConv2D.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/DepthwiseConv2D.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleDepthwiseConv2D(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *filter = inputs.at(1); - const Tensor *bias = inputs.at(2); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsDepthwiseConv2DOptions(); - - DepthwiseConv2DParams params{}; - params.padding = luci_padding(options->padding); - params.depth_multiplier = options->depth_multiplier; - params.stride_height = options->stride_h; - params.stride_width = options->stride_w; - params.dilation_height_factor = options->dilation_h_factor; - params.dilation_width_factor = options->dilation_w_factor; - params.activation = luci_actfunc(options->fused_activation_function); - - // It is unknown what data will be stored in scratchpad tensor, - // using UINT8 as a most general option - auto scratchpad = std::make_unique<Tensor>(DataType::U8, Shape({}), nullptr); - scratchpad->set_data_buffer(nullptr); - // TODO move tensors offset initialization to one place - // TODO handle with StaticManager - Tensor *tmp = builder.get_runtime_graph()->addTensor(std::move(scratchpad)); - - return std::make_unique<kernels::DepthwiseConv2D>(input, filter, bias, output, tmp, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Dequantize.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Dequantize.cpp deleted file mode 100644 index 06b75187b..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Dequantize.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Dequantize.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleDequantize(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Dequantize>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Div.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Div.cpp deleted file mode 100644 index 3331df91f..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Div.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Div.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleDiv(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsDivOptions(); - - DivParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::Div>(input1, input2, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Elu.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Elu.cpp deleted file mode 100644 index 2d8932803..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Elu.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Elu.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleElu(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Elu>(input, output); -} -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Equal.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Equal.cpp deleted file mode 100644 index eee500945..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Equal.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Equal.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleEqual(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) - -{ - assert(inputs.size() == 2); - - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Equal>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Exp.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Exp.cpp deleted file mode 100644 index 401b6d064..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Exp.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Exp.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleExp(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Exp>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/ExpandDims.cpp b/onert-micro/luci-interpreter/src/loader/nodes/ExpandDims.cpp deleted file mode 100644 index f4745b3f6..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/ExpandDims.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/ExpandDims.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleExpandDims(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *input = inputs.at(0); - const Tensor *axis = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::ExpandDims>(input, axis, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Fill.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Fill.cpp deleted file mode 100644 index cd5a3368c..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Fill.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Fill.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleFill(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *dims = inputs.at(0); - const Tensor *value = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Fill>(dims, value, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Floor.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Floor.cpp deleted file mode 100644 index 59164ce9f..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Floor.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Floor.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleFloor(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Floor>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/FloorDiv.cpp b/onert-micro/luci-interpreter/src/loader/nodes/FloorDiv.cpp deleted file mode 100644 index 7caf12371..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/FloorDiv.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/FloorDiv.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleFloorDiv(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::FloorDiv>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/FullyConnected.cpp b/onert-micro/luci-interpreter/src/loader/nodes/FullyConnected.cpp deleted file mode 100644 index cb35c0f68..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/FullyConnected.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/FullyConnected.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleFullyConnected(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *weights = inputs.at(1); - const Tensor *bias = inputs.at(2); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsFullyConnectedOptions(); - - FullyConnectedParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - params.keep_num_dims = options->keep_num_dims; - - return std::make_unique<kernels::FullyConnected>(input, weights, bias, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Gather.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Gather.cpp deleted file mode 100644 index 02cb7e652..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Gather.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Gather.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleGather(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *params = inputs.at(0); - const Tensor *indices = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsGatherOptions(); - - GatherParams gparams{}; - gparams.axis = options->axis; - // TODO support batch_dims - gparams.batch_dims = 0; - - return std::make_unique<kernels::Gather>(params, indices, output, gparams); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Greater.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Greater.cpp deleted file mode 100644 index 160911eb8..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Greater.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Greater.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleGreater(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Greater>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/GreaterEqual.cpp b/onert-micro/luci-interpreter/src/loader/nodes/GreaterEqual.cpp deleted file mode 100644 index 4c196823c..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/GreaterEqual.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/GreaterEqual.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleGreaterEqual(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::GreaterEqual>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/If.cpp b/onert-micro/luci-interpreter/src/loader/nodes/If.cpp deleted file mode 100644 index 1c6f12cce..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/If.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/If.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleIf(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - // TODO: support IF operation - assert(false && "Not supported now"); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/InstanceNorm.cpp b/onert-micro/luci-interpreter/src/loader/nodes/InstanceNorm.cpp deleted file mode 100644 index 1d7f63900..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/InstanceNorm.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/InstanceNorm.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleInstanceNorm(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *gamma = inputs.at(1); - const Tensor *beta = inputs.at(2); - - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsInstanceNormOptions(); - - InstanceNormParams params{}; - params.epsilon = options->epsilon; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::InstanceNorm>(input, gamma, beta, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/L2Normalize.cpp b/onert-micro/luci-interpreter/src/loader/nodes/L2Normalize.cpp deleted file mode 100644 index 6435f0909..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/L2Normalize.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/L2Normalize.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleL2Normalize(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsL2NormOptions(); - - L2NormParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::L2Normalize>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/L2Pool2D.cpp b/onert-micro/luci-interpreter/src/loader/nodes/L2Pool2D.cpp deleted file mode 100644 index d297525bf..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/L2Pool2D.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/L2Pool2D.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleL2Pool2D(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsPool2DOptions(); - - Pool2DParams params{}; - params.padding = luci_padding(options->padding); - params.filter_height = options->filter_height; - params.filter_width = options->filter_width; - params.stride_height = options->stride_h; - params.stride_width = options->stride_w; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::L2Pool2D>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LeakyRelu.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LeakyRelu.cpp deleted file mode 100644 index 2cb27e2a4..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LeakyRelu.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LeakyRelu.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLeakyRelu(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsLeakyReluOptions(); - - LeakyReluParams params{}; - params.alpha = options->alpha; - - return std::make_unique<kernels::LeakyRelu>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Less.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Less.cpp deleted file mode 100644 index 9de9dbe94..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Less.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Less.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLess(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Less>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LessEqual.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LessEqual.cpp deleted file mode 100644 index ca4f26cd3..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LessEqual.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LessEqual.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLessEqual(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::LessEqual>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LocalResponseNormalization.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LocalResponseNormalization.cpp deleted file mode 100644 index 71ed6348d..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LocalResponseNormalization.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LocalResponseNormalization.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> -build_kernel_CircleLocalResponseNormalization(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsLocalResponseNormalizationOptions(); - - LocalResponseNormalizationParams params{}; - params.radius = options->radius; - params.bias = options->bias; - params.alpha = options->alpha; - params.beta = options->beta; - - return std::make_unique<kernels::LocalResponseNormalization>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LogSoftmax.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LogSoftmax.cpp deleted file mode 100644 index 03e40e98b..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LogSoftmax.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LogSoftmax.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLogSoftmax(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::LogSoftmax>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LogicalAnd.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LogicalAnd.cpp deleted file mode 100644 index 32677a7b4..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LogicalAnd.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LogicalAnd.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLogicalAnd(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::LogicalAnd>(input1, input2, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LogicalNot.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LogicalNot.cpp deleted file mode 100644 index 43ec1e491..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LogicalNot.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LogicalNot.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLogicalNot(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::LogicalNot>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/LogicalOr.cpp b/onert-micro/luci-interpreter/src/loader/nodes/LogicalOr.cpp deleted file mode 100644 index 7ce29a883..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/LogicalOr.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/LogicalOr.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLogicalOr(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::LogicalOr>(input1, input2, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Logistic.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Logistic.cpp deleted file mode 100644 index 113b5eab4..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Logistic.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Logistic.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleLogistic(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Logistic>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/MaxPool2D.cpp b/onert-micro/luci-interpreter/src/loader/nodes/MaxPool2D.cpp deleted file mode 100644 index 40fff4df5..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/MaxPool2D.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/MaxPool2D.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleMaxPool2D(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsPool2DOptions(); - - Pool2DParams params{}; - params.padding = luci_padding(options->padding); - params.filter_height = options->filter_height; - params.filter_width = options->filter_width; - params.stride_height = options->stride_h; - params.stride_width = options->stride_w; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::MaxPool2D>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Maximum.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Maximum.cpp deleted file mode 100644 index 1a7930a1a..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Maximum.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Maximum.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleMaximum(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Maximum>(input1, input2, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Mean.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Mean.cpp deleted file mode 100644 index 6ef48bc95..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Mean.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Mean.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleMean(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *axis = inputs.at(1); - Tensor *output = outputs.at(0); - - auto temp_index_unique = std::make_unique<Tensor>(DataType::S32, Shape({}), nullptr); - temp_index_unique->set_data_buffer(nullptr); - Tensor *temp_index = builder.get_runtime_graph()->addTensor(std::move(temp_index_unique)); - - auto resolved_axes_unique = std::make_unique<Tensor>(DataType::S32, Shape({}), nullptr); - resolved_axes_unique->set_data_buffer(nullptr); - Tensor *resolved_axes = builder.get_runtime_graph()->addTensor(std::move(resolved_axes_unique)); - - auto temp_sum_unique = std::make_unique<Tensor>(input->element_type(), Shape({}), nullptr); - temp_sum_unique->set_data_buffer(nullptr); - Tensor *temp_sum = builder.get_runtime_graph()->addTensor(std::move(temp_sum_unique)); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsReducerOptions(); - - ReducerParams params{}; - params.keep_dims = options->keep_dims; - - return std::make_unique<kernels::Mean>(input, axis, output, temp_index, resolved_axes, temp_sum, - params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Minimum.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Minimum.cpp deleted file mode 100644 index 232ebf020..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Minimum.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Minimum.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleMinimum(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Minimum>(input1, input2, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/MirrorPad.cpp b/onert-micro/luci-interpreter/src/loader/nodes/MirrorPad.cpp deleted file mode 100644 index d96ad2500..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/MirrorPad.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/MirrorPad.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleMirrorPad(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *paddings = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsMirrorPadOptions(); - - MirrorPadParams params{}; - params.mode = luci_mirrorpad_mode(options->mode); - - return std::make_unique<kernels::MirrorPad>(input, paddings, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Mul.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Mul.cpp deleted file mode 100644 index 283f0427a..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Mul.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Mul.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleMul(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsMulOptions(); - - MulParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::Mul>(input1, input2, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Neg.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Neg.cpp deleted file mode 100644 index a898f41f5..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Neg.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Neg.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleNeg(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Neg>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/NotEqual.cpp b/onert-micro/luci-interpreter/src/loader/nodes/NotEqual.cpp deleted file mode 100644 index 1c8493146..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/NotEqual.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/NotEqual.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleNotEqual(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *x = inputs.at(0); - const Tensor *y = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::NotEqual>(x, y, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/OneHot.cpp b/onert-micro/luci-interpreter/src/loader/nodes/OneHot.cpp deleted file mode 100644 index a1c8a5bf5..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/OneHot.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/OneHot.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleOneHot(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 4); - - const Tensor *indices = inputs.at(0); - const Tensor *depth = inputs.at(1); - const Tensor *on_value = inputs.at(2); - const Tensor *off_value = inputs.at(3); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsOneHotOptions(); - - OneHotParams params{}; - params.axis = options->axis; - - return std::make_unique<kernels::OneHot>(indices, depth, on_value, off_value, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/PRelu.cpp b/onert-micro/luci-interpreter/src/loader/nodes/PRelu.cpp deleted file mode 100644 index 6adc5495b..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/PRelu.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/PRelu.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CirclePRelu(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *alpha = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::PRelu>(input, alpha, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Pack.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Pack.cpp deleted file mode 100644 index a92196b4e..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Pack.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Pack.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CirclePack(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - std::vector<const Tensor *> input_tensors(inputs.size()); - for (uint32_t i = 0; i < inputs.size(); ++i) - { - input_tensors[i] = inputs.at(i); - } - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsPackOptions(); - - PackParams params{}; - params.axis = options->axis; - params.values_count = options->values_count; - - return std::make_unique<kernels::Pack>(std::move(input_tensors), output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Pad.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Pad.cpp deleted file mode 100644 index 26aa7e761..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Pad.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Pad.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CirclePad(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *paddings = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Pad>(input, paddings, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/PadV2.cpp b/onert-micro/luci-interpreter/src/loader/nodes/PadV2.cpp deleted file mode 100644 index 829c47f3e..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/PadV2.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/PadV2.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CirclePadV2(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *paddings = inputs.at(1); - const Tensor *constant_values = inputs.at(2); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::PadV2>(input, paddings, constant_values, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Pow.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Pow.cpp deleted file mode 100644 index 005c28132..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Pow.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Pow.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CirclePow(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Pow>(input1, input2, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Quantize.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Quantize.cpp deleted file mode 100644 index 4fa7e66ab..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Quantize.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Quantize.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleQuantize(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Quantize>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Relu.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Relu.cpp deleted file mode 100644 index 27fcb6b40..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Relu.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Relu.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleRelu(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Relu>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Relu6.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Relu6.cpp deleted file mode 100644 index 68dba2c44..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Relu6.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Relu6.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleRelu6(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Relu6>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Reshape.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Reshape.cpp deleted file mode 100644 index 45ebf0a50..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Reshape.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Reshape.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleReshape(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *shape = inputs.at(1); - Tensor *output = outputs.at(0); - - // NOTE 'newShape' attribute is ignored. - return std::make_unique<kernels::Reshape>(input, shape, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/ResizeBilinear.cpp b/onert-micro/luci-interpreter/src/loader/nodes/ResizeBilinear.cpp deleted file mode 100644 index bd82048a5..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/ResizeBilinear.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/ResizeBilinear.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleResizeBilinear(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *size = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsResizeBilinearOptions(); - - ResizeBilinearParams params{}; - params.align_corners = options->align_corners; - params.half_pixel_centers = options->half_pixel_centers; - - return std::make_unique<kernels::ResizeBilinear>(input, size, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/ResizeNearestNeighbor.cpp b/onert-micro/luci-interpreter/src/loader/nodes/ResizeNearestNeighbor.cpp deleted file mode 100644 index bc59e87bb..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/ResizeNearestNeighbor.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/ResizeNearestNeighbor.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> -build_kernel_CircleResizeNearestNeighbor(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *size = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsResizeNearestNeighborOptions(); - - ResizeNearestNeighborParams params{}; - params.align_corners = options->align_corners; - // TODO update half_pixel_centers after CircleResizeNearestNeighbor updated - // Current CircleResizeNearestNeighbor don't have half_pixel_centers. - // default value on current is false. - // it need to be updated when CircleResizeNearestNeighbor updated. - params.half_pixel_centers = false; - - return std::make_unique<kernels::ResizeNearestNeighbor>(input, size, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/ReverseV2.cpp b/onert-micro/luci-interpreter/src/loader/nodes/ReverseV2.cpp deleted file mode 100644 index 0b23ee0ce..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/ReverseV2.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/ReverseV2.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleReverseV2(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *axis = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::ReverseV2>(input, axis, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Rsqrt.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Rsqrt.cpp deleted file mode 100644 index 87ca438a7..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Rsqrt.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Rsqrt.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleRsqrt(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Rsqrt>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/SVDF.cpp b/onert-micro/luci-interpreter/src/loader/nodes/SVDF.cpp deleted file mode 100644 index 8a77459ea..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/SVDF.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/SVDF.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSVDF(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 5); - - const Tensor *input = inputs.at(0); - const Tensor *feature = inputs.at(1); - const Tensor *time = inputs.at(2); - const Tensor *bias = inputs.at(3); - const Tensor *input_activation_state = inputs.at(4); - Tensor *output = outputs.at(0); - - auto scratchpad_tensor = - std::make_unique<Tensor>(input_activation_state->element_type(), Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - DataType data_type = input->element_type() == DataType::S8 ? DataType::S32 : DataType::FLOAT32; - - scratchpad_tensor = std::make_unique<Tensor>(data_type, Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp_1 = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - if (data_type == DataType::FLOAT32 && - (feature->element_type() == DataType::S8 || feature->element_type() == DataType::U8)) - { - data_type = feature->element_type(); - } - - scratchpad_tensor = std::make_unique<Tensor>(data_type, Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp_2 = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - data_type = DataType::FLOAT32; - - scratchpad_tensor = std::make_unique<Tensor>(data_type, Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp_3 = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - scratchpad_tensor = std::make_unique<Tensor>(data_type, Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp_4 = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - scratchpad_tensor = std::make_unique<Tensor>(data_type, Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp_5 = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - scratchpad_tensor = std::make_unique<Tensor>(data_type, Shape({}), nullptr); - scratchpad_tensor->set_data_buffer(nullptr); - Tensor *tmp_6 = builder.get_runtime_graph()->addTensor(std::move(scratchpad_tensor)); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsSVDFOptions(); - - SVDFParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - params.svdf_rank = options->rank; - params.asymmetric_quantize_inputs = options->asymmetric_quantize_inputs; - - return std::make_unique<kernels::SVDF>(input, feature, time, bias, input_activation_state, output, - tmp, tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, tmp_6, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Shape.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Shape.cpp deleted file mode 100644 index 69a727fae..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Shape.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Shape.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleShape(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsShapeOptions(); - - ShapeParams shape_params{}; - shape_params.out_type = luci_datatype(options->out_type); - - return std::make_unique<kernels::ShapeKernel>(input, output, shape_params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Slice.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Slice.cpp deleted file mode 100644 index e28742b3f..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Slice.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Slice.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSlice(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *begin = inputs.at(1); - const Tensor *size = inputs.at(2); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Slice>(input, begin, size, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Softmax.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Softmax.cpp deleted file mode 100644 index 1957a76f4..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Softmax.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Softmax.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSoftmax(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsSoftmaxOptions(); - - SoftmaxParams params{}; - params.beta = options->beta; - - return std::make_unique<kernels::Softmax>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/SpaceToBatchND.cpp b/onert-micro/luci-interpreter/src/loader/nodes/SpaceToBatchND.cpp deleted file mode 100644 index c5553c63e..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/SpaceToBatchND.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/SpaceToBatchND.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSpaceToBatchND(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *block_shape = inputs.at(1); - const Tensor *paddings = inputs.at(2); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::SpaceToBatchND>(input, block_shape, paddings, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/SpaceToDepth.cpp b/onert-micro/luci-interpreter/src/loader/nodes/SpaceToDepth.cpp deleted file mode 100644 index 156976a63..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/SpaceToDepth.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/SpaceToDepth.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSpaceToDepth(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsSpaceToDepthOptions(); - - SpaceToDepthParams params{}; - params.block_size = options->block_size; - - return std::make_unique<kernels::SpaceToDepth>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Split.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Split.cpp deleted file mode 100644 index ecec1cbca..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Split.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Split.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSplit(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *axis = inputs.at(0); - const Tensor *input = inputs.at(1); - std::vector<Tensor *> output_tensors(outputs.size()); - - for (uint32_t i = 0; i < outputs.size(); ++i) - { - output_tensors[i] = outputs.at(i).first; - } - - // NOTE 'num_splits' attribute is ignored. - return std::make_unique<kernels::Split>(axis, input, std::move(output_tensors)); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/SplitV.cpp b/onert-micro/luci-interpreter/src/loader/nodes/SplitV.cpp deleted file mode 100644 index a4c0ae28d..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/SplitV.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/SplitV.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSplitV(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 3); - - const Tensor *input = inputs.at(0); - const Tensor *sizes_data = inputs.at(1); - const Tensor *axis = inputs.at(2); - std::vector<Tensor *> output_tensors(outputs.size()); - - for (uint32_t i = 0; i < outputs.size(); ++i) - { - output_tensors[i] = outputs.at(i).first; - } - - // NOTE 'num_splits' attribute is ignored. - return std::make_unique<kernels::SplitV>(input, sizes_data, axis, std::move(output_tensors)); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Sqrt.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Sqrt.cpp deleted file mode 100644 index 3eaf2343d..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Sqrt.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Sqrt.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSqrt(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Sqrt>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Square.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Square.cpp deleted file mode 100644 index 1afc6ccde..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Square.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Square.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSquare(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Square>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/SquaredDifference.cpp b/onert-micro/luci-interpreter/src/loader/nodes/SquaredDifference.cpp deleted file mode 100644 index 0a5ba788d..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/SquaredDifference.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/SquaredDifference.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSquaredDifference(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::SquaredDifference>(input1, input2, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Squeeze.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Squeeze.cpp deleted file mode 100644 index 4f0c265eb..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Squeeze.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Squeeze.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSqueeze(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsSqueezeOptions(); - - SqueezeParams params{}; - params.squeeze_dims = options->squeeze_dims; - - return std::make_unique<kernels::Squeeze>(input, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/StridedSlice.cpp b/onert-micro/luci-interpreter/src/loader/nodes/StridedSlice.cpp deleted file mode 100644 index c0a53fc94..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/StridedSlice.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/StridedSlice.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleStridedSlice(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 4); - - const Tensor *input = inputs.at(0); - const Tensor *begin = inputs.at(1); - const Tensor *end = inputs.at(2); - const Tensor *strides = inputs.at(3); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsStridedSliceOptions(); - - StridedSliceParams params{}; - params.begin_mask = options->begin_mask; - params.ellipsis_mask = options->ellipsis_mask; - params.end_mask = options->end_mask; - params.new_axis_mask = options->new_axis_mask; - params.shrink_axis_mask = options->shrink_axis_mask; - - return std::make_unique<kernels::StridedSlice>(input, begin, end, strides, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Sub.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Sub.cpp deleted file mode 100644 index 79c773bdf..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Sub.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Sub.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleSub(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input1 = inputs.at(0); - const Tensor *input2 = inputs.at(1); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsSubOptions(); - - SubParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - - return std::make_unique<kernels::Sub>(input1, input2, output, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Tanh.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Tanh.cpp deleted file mode 100644 index f4aff4c57..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Tanh.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Tanh.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleTanh(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - const Tensor *input = inputs.at(0); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Tanh>(input, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Transpose.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Transpose.cpp deleted file mode 100644 index 83b466d6a..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Transpose.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Transpose.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleTranspose(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 2); - - const Tensor *input = inputs.at(0); - const Tensor *perm = inputs.at(1); - Tensor *output = outputs.at(0); - - return std::make_unique<kernels::Transpose>(input, perm, output); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/TransposeConv.cpp b/onert-micro/luci-interpreter/src/loader/nodes/TransposeConv.cpp deleted file mode 100644 index 06ee63eb1..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/TransposeConv.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/TransposeConv.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleTransposeConv(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, - KernelBuilder &builder) -{ - assert(inputs.size() == 4); - - const Tensor *input_sizes = inputs.at(0); - const Tensor *filter = inputs.at(1); - const Tensor *out_backprop = inputs.at(2); - const Tensor *bias = inputs.at(3); - Tensor *output = outputs.at(0); - - DataType scratch_data_type = - input_sizes->element_type() == DataType::S16 ? DataType::S64 : DataType::S32; - - auto scratch_tensor = std::make_unique<Tensor>(scratch_data_type, Shape({}), nullptr); - scratch_tensor->set_data_buffer(nullptr); - Tensor *tmp = builder.get_runtime_graph()->addTensor(std::move(scratch_tensor)); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsTransposeConvOptions(); - - TransposeConvParams params{}; - params.padding = luci_padding(options->padding); - params.stride_height = options->stride_h; - params.stride_width = options->stride_w; - - return std::make_unique<kernels::TransposeConv>(input_sizes, filter, out_backprop, bias, output, - tmp, params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/UnidirectionalSequenceLSTM.cpp b/onert-micro/luci-interpreter/src/loader/nodes/UnidirectionalSequenceLSTM.cpp deleted file mode 100644 index b66e53fb7..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/UnidirectionalSequenceLSTM.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved - * Copyright 2017 The TensorFlow Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/UnidirectionalSequenceLSTM.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> -build_kernel_CircleUnidirectionalSequenceLSTM(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 24); - const Tensor *input = inputs.at(0); - const Tensor *input_to_input_weights = inputs.at(1); - const Tensor *input_to_forget_weights = inputs.at(2); - const Tensor *input_to_cell_weights = inputs.at(3); - const Tensor *input_to_output_weights = inputs.at(4); - - const Tensor *recurrent_to_input_weights = inputs.at(5); - const Tensor *recurrent_to_forget_weights = inputs.at(6); - const Tensor *recurrent_to_cell_weights = inputs.at(7); - const Tensor *recurrent_to_output_weights = inputs.at(8); - - const Tensor *cell_to_input_weights = inputs.at(9); - const Tensor *cell_to_forget_weights = inputs.at(10); - const Tensor *cell_to_output_weights = inputs.at(11); - - const Tensor *input_gate_bias = inputs.at(12); - const Tensor *forget_gate_bias = inputs.at(13); - const Tensor *cell_gate_bias = inputs.at(14); - const Tensor *output_gate_bias = inputs.at(15); - - const Tensor *projection_weights = inputs.at(16); - const Tensor *projection_bias = inputs.at(17); - - Tensor *output_state = const_cast<Tensor *>(inputs.at(18)); - Tensor *cell_state = const_cast<Tensor *>(inputs.at(19)); - - const Tensor *input_layer_norm_coefficients = inputs.at(20); - const Tensor *forget_layer_norm_coefficients = inputs.at(21); - const Tensor *cell_layer_norm_coefficients = inputs.at(22); - const Tensor *output_layer_norm_coefficients = inputs.at(23); - Tensor *output = outputs.at(0); - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsUnidirectionalSequenceLSTMOptions(); - - UnidirectionalSequenceLSTMParams params{}; - params.activation = luci_actfunc(options->fused_activation_function); - params.cell_clip = options->cell_clip; - params.proj_clip = options->proj_clip; - params.time_major = options->time_major; - params.asymmetric_quantize_inputs = options->asymmetric_quantize_inputs; - - // scratch pad tensor - const bool is_integer = input->element_type() == DataType::S8; - bool use_layer_norm = (forget_layer_norm_coefficients != nullptr); - - if (is_integer) - { - if (not use_layer_norm) - { - params.intermediate_affine_quant = - builder.get_runtime_graph()->getIntermediateAffineQuantizations(); - - // For integer LSTM need 4 16-bit buffer with size n_batch * n_cell - // and 1 8-bit buffer with size n_batch * n_cell - auto tmp_1 = std::make_unique<Tensor>(DataType::S16, Shape({}), nullptr); - tmp_1->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(tmp_1))); - - auto tmp_2 = std::make_unique<Tensor>(DataType::S16, Shape({}), nullptr); - tmp_2->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(tmp_2))); - - auto tmp_3 = std::make_unique<Tensor>(DataType::S16, Shape({}), nullptr); - tmp_3->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(tmp_3))); - - auto tmp_4 = std::make_unique<Tensor>(DataType::S16, Shape({}), nullptr); - tmp_4->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(tmp_4))); - - auto tmp_5 = std::make_unique<Tensor>( - DataType::S8, Shape({}), - builder.get_runtime_graph()->getIntermediateAffineQuantizations()[0]); - tmp_5->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(tmp_5))); - } - else - { - // TODO: support float - assert(false && "Not supported now"); - } - } - else - { - // NOTE provide more scratch pads if support hybrid or integer - auto sp_output_state = - std::make_unique<Tensor>(output_state->element_type(), Shape({}), nullptr); - sp_output_state->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(sp_output_state))); - - auto sp_cell_state = std::make_unique<Tensor>(cell_state->element_type(), Shape({}), nullptr); - sp_cell_state->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(sp_cell_state))); - - auto sp_3 = std::make_unique<Tensor>(input->element_type(), Shape({}), nullptr); - sp_3->set_data_buffer(nullptr); - outputs.push_back(builder.get_runtime_graph()->addTensor(std::move(sp_3))); - } - - outputs.push_back(output_state); - outputs.push_back(cell_state); - - return std::make_unique<kernels::UnidirectionalSequenceLSTM>( - input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, - input_to_output_weights, recurrent_to_input_weights, recurrent_to_forget_weights, - recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, - cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, - cell_gate_bias, output_gate_bias, projection_weights, projection_bias, - input_layer_norm_coefficients, forget_layer_norm_coefficients, cell_layer_norm_coefficients, - output_layer_norm_coefficients, std::move(outputs), params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/Unpack.cpp b/onert-micro/luci-interpreter/src/loader/nodes/Unpack.cpp deleted file mode 100644 index 7f067f474..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/Unpack.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/Unpack.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleUnpack(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - assert(inputs.size() == 1); - - const Tensor *input = inputs.at(0); - std::vector<Tensor *> output_tensors(outputs.size()); - - for (uint32_t i = 0; i < outputs.size(); ++i) - { - output_tensors[i] = outputs.at(i); - } - - circle::OperatorT oper_t; - builder.get_circle_reader()->operators()[op_index]->UnPackTo(&oper_t); - const auto *options = oper_t.builtin_options.AsUnpackOptions(); - - UnpackParams params{}; - params.axis = options->axis; - - // NOTE 'num' attribute is ignored. - return std::make_unique<kernels::Unpack>(input, std::move(output_tensors), params); -} - -} // namespace luci_interpreter diff --git a/onert-micro/luci-interpreter/src/loader/nodes/While.cpp b/onert-micro/luci-interpreter/src/loader/nodes/While.cpp deleted file mode 100644 index b1f719efc..000000000 --- a/onert-micro/luci-interpreter/src/loader/nodes/While.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Builders.h" - -#include "kernels/While.h" - -namespace luci_interpreter -{ - -std::unique_ptr<Kernel> build_kernel_CircleWhile(std::vector<const Tensor *> &&inputs, - std::vector<Tensor *> &&outputs, - const uint32_t op_index, KernelBuilder &builder) -{ - // TODO: support IF operation - assert(false && "Not supported now"); -} - -} // namespace luci_interpreter |