From 33b263af2f646cf0210bf5cac49a3bee7aa1f38e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=91=D0=B0=D1=80?= =?utf8?q?=D0=B0=D0=BD=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2/AI=20Tools=20Lab=20/S?= =?utf8?q?RR/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 20 Aug 2019 02:39:16 +0900 Subject: [PATCH] [mir_onnx] Remove GivenTensorFill converter (#6666) This operation is not a part of the ONNX specification. Signed-off-by: Sergei Barannikov --- compiler/mir-onnx-importer/CMakeLists.txt | 2 - compiler/mir-onnx-importer/ONNXOpRegistration.h | 2 - compiler/mir-onnx-importer/Op/GivenTensorFill.cpp | 48 ----------------------- compiler/mir-onnx-importer/Op/GivenTensorFill.h | 28 ------------- 4 files changed, 80 deletions(-) delete mode 100644 compiler/mir-onnx-importer/Op/GivenTensorFill.cpp delete mode 100644 compiler/mir-onnx-importer/Op/GivenTensorFill.h diff --git a/compiler/mir-onnx-importer/CMakeLists.txt b/compiler/mir-onnx-importer/CMakeLists.txt index 7e7072d..df03dd6 100644 --- a/compiler/mir-onnx-importer/CMakeLists.txt +++ b/compiler/mir-onnx-importer/CMakeLists.txt @@ -29,8 +29,6 @@ set(MIR_ONNX_IMPORTER_SOURCES Op/Gather.h Op/Gemm.cpp Op/Gemm.h - Op/GivenTensorFill.cpp - Op/GivenTensorFill.h Op/GlobalAveragePool.cpp Op/GlobalAveragePool.h Op/Max.cpp diff --git a/compiler/mir-onnx-importer/ONNXOpRegistration.h b/compiler/mir-onnx-importer/ONNXOpRegistration.h index f16a399..763d938 100644 --- a/compiler/mir-onnx-importer/ONNXOpRegistration.h +++ b/compiler/mir-onnx-importer/ONNXOpRegistration.h @@ -28,7 +28,6 @@ #include "Op/Dropout.h" #include "Op/Gather.h" #include "Op/Gemm.h" -#include "Op/GivenTensorFill.h" #include "Op/GlobalAveragePool.h" #include "Op/Max.h" #include "Op/MaxPool.h" @@ -59,7 +58,6 @@ inline void registerSupportedOps() registry.registerConverter("Dropout", stdex::make_unique()); registry.registerConverter("Gather", stdex::make_unique()); registry.registerConverter("Gemm", stdex::make_unique()); - registry.registerConverter("GivenTensorFill", stdex::make_unique()); registry.registerConverter("GlobalAveragePool", stdex::make_unique()); registry.registerConverter("Max", stdex::make_unique()); diff --git a/compiler/mir-onnx-importer/Op/GivenTensorFill.cpp b/compiler/mir-onnx-importer/Op/GivenTensorFill.cpp deleted file mode 100644 index 7608b9a..0000000 --- a/compiler/mir-onnx-importer/Op/GivenTensorFill.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019 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 "GivenTensorFill.h" - -#include "ONNXHelpers.h" - -#include "mir/TensorVariant.h" - -#include "mir/ops/ConstantOp.h" - -namespace mir_onnx -{ - -void GivenTensorFillNodeConverter::convert(const onnx::NodeProto &onnx_node, - ConverterContext *context) const -{ - std::vector inputs = context->getNodeInputs(onnx_node); - mir::Graph *graph = context->getGraph(); - auto values_att = findAttribute(onnx_node, "values"); - auto shape_att = findAttribute(onnx_node, "shape"); - assert(values_att && shape_att); - assert(values_att->floats_size() > 0 && shape_att->ints_size() > 0); - mir::Shape shape(shape_att->ints_size()); - for (int i = 0; i < shape_att->ints_size(); i++) - shape.dim(i) = shape_att->ints(i); - mir::TensorVariant tensor(mir::DTYPE::FLOAT32, shape, values_att->floats().data()); - // TODO Check right removing input_tensors - // input_tensors.insert(std::make_pair(onnx_node.output(0), tensor)); - auto result = createOp(graph, tensor)->getOutput(0); - - context->setNodeOutputs(onnx_node, {result}); -} - -} // namespace mir_onnx diff --git a/compiler/mir-onnx-importer/Op/GivenTensorFill.h b/compiler/mir-onnx-importer/Op/GivenTensorFill.h deleted file mode 100644 index 0aafa87..0000000 --- a/compiler/mir-onnx-importer/Op/GivenTensorFill.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2019 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 "ONNXNodeConverterRegistry.h" - -namespace mir_onnx -{ - -class GivenTensorFillNodeConverter : public NodeConverter -{ -public: - void convert(const onnx::NodeProto &onnx_node, ConverterContext *context) const override; -}; - -} // namespace mir_onnx -- 2.7.4