[mir_onnx] Remove GivenTensorFill converter (#6666)
authorСергей Баранников/AI Tools Lab /SRR/Engineer/삼성전자 <s.barannikov@samsung.com>
Mon, 19 Aug 2019 17:39:16 +0000 (02:39 +0900)
committerAlexander Efimov/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Mon, 19 Aug 2019 17:39:16 +0000 (20:39 +0300)
This operation is not a part of the ONNX specification.

Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
compiler/mir-onnx-importer/CMakeLists.txt
compiler/mir-onnx-importer/ONNXOpRegistration.h
compiler/mir-onnx-importer/Op/GivenTensorFill.cpp [deleted file]
compiler/mir-onnx-importer/Op/GivenTensorFill.h [deleted file]

index 7e7072d..df03dd6 100644 (file)
@@ -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
index f16a399..763d938 100644 (file)
@@ -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<DropoutNodeConverter>());
   registry.registerConverter("Gather", stdex::make_unique<GatherNodeConverter>());
   registry.registerConverter("Gemm", stdex::make_unique<GemmNodeConverter>());
-  registry.registerConverter("GivenTensorFill", stdex::make_unique<GivenTensorFillNodeConverter>());
   registry.registerConverter("GlobalAveragePool",
                              stdex::make_unique<GlobalAveragePoolNodeConverter>());
   registry.registerConverter("Max", stdex::make_unique<MaxNodeConverter>());
diff --git a/compiler/mir-onnx-importer/Op/GivenTensorFill.cpp b/compiler/mir-onnx-importer/Op/GivenTensorFill.cpp
deleted file mode 100644 (file)
index 7608b9a..0000000
+++ /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<mir::Operation::Output *> 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<mir::ops::ConstantOp>(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 (file)
index 0aafa87..0000000
+++ /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