[mir] Remove BiasAdd and Scale ops (#6416)
authorСергей Баранников/AI Tools Lab /SRR/Engineer/삼성전자 <s.barannikov@samsung.com>
Fri, 9 Aug 2019 10:25:18 +0000 (13:25 +0300)
committerAlexander Efimov/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Fri, 9 Aug 2019 10:25:18 +0000 (13:25 +0300)
These were replaced by more general binary elementwise operations.

Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
compiler/mir/include/mir/IrDotDumper.h
compiler/mir/include/mir/OpDefs.h
compiler/mir/include/mir/Operations.inc
compiler/mir/include/mir/ops/BiasAddOp.h [deleted file]
compiler/mir/include/mir/ops/ScaleOp.h [deleted file]
compiler/mir/src/IrDotDumper.cpp
compiler/mir/src/Operation.cpp

index c12b103..03158a6 100644 (file)
@@ -31,7 +31,6 @@ class IrDotDumper : public IVisitor
 {
 public:
   void visit(ops::BatchNormOp &op) override;
-  void visit(ops::BiasAddOp &op) override;
   void visit(ops::CappedReluOp &op) override;
   void visit(ops::ConcatOp &op) override;
   void visit(ops::ConstantOp &op) override;
@@ -53,7 +52,6 @@ public:
   void visit(ops::ReluOp &op) override;
   void visit(ops::ReshapeOp &op) override;
   void visit(ops::ResizeOp &op) override;
-  void visit(ops::ScaleOp &op) override;
   void visit(ops::SigmoidOp &op) override;
   void visit(ops::SliceOp &op) override;
   void visit(ops::SoftmaxOp &op) override;
index 3a5034d..d685cd6 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "mir/ops/AddOp.h"
 #include "mir/ops/BatchNormOp.h"
-#include "mir/ops/BiasAddOp.h"
 #include "mir/ops/CappedReluOp.h"
 #include "mir/ops/CommonProps.h"
 #include "mir/ops/ConcatOp.h"
@@ -45,7 +44,6 @@
 #include "mir/ops/ReluOp.h"
 #include "mir/ops/ReshapeOp.h"
 #include "mir/ops/ResizeOp.h"
-#include "mir/ops/ScaleOp.h"
 #include "mir/ops/SigmoidOp.h"
 #include "mir/ops/SliceOp.h"
 #include "mir/ops/SoftmaxOp.h"
index 791d807..6c18200 100644 (file)
@@ -20,7 +20,6 @@
 
 HANDLE_OP(add, AddOp)
 HANDLE_OP(batchNorm, BatchNormOp)
-HANDLE_OP(biasAdd, BiasAddOp)
 HANDLE_OP(cappedReLU, CappedReluOp)
 HANDLE_OP(concat, ConcatOp)
 HANDLE_OP(constant, ConstantOp)
@@ -45,7 +44,6 @@ HANDLE_OP(reduce, ReduceOp)
 HANDLE_OP(ReLU, ReluOp)
 HANDLE_OP(reshape, ReshapeOp)
 HANDLE_OP(resizeIm, ResizeOp)
-HANDLE_OP(scale, ScaleOp)
 HANDLE_OP(sigmoid, SigmoidOp)
 HANDLE_OP(slice, SliceOp)
 HANDLE_OP(softmax, SoftmaxOp)
diff --git a/compiler/mir/include/mir/ops/BiasAddOp.h b/compiler/mir/include/mir/ops/BiasAddOp.h
deleted file mode 100644 (file)
index b636e80..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-
-#ifndef _MIR_OPS_BIAS_ADD_H_
-#define _MIR_OPS_BIAS_ADD_H_
-
-#include "mir/Operation.h"
-#include "mir/TensorVariant.h"
-
-namespace mir
-{
-namespace ops
-{
-
-class BiasAddOp : public Operation
-{
-public:
-  BiasAddOp(Output *arg1, Output *arg2) : Operation(Type::biasAdd, {arg1, arg2})
-  {
-    // Infer output shape.
-    setOutputShape(0, getInputShape(0));
-  }
-
-  Operation *copyWithInputs(const std::vector<Output *> &inputs) override
-  {
-    return new BiasAddOp(inputs[0], inputs[1]);
-  }
-};
-
-} // namespace ops
-} // namespace mir
-
-#endif //_MIR_OPS_BIAS_ADD_H_
diff --git a/compiler/mir/include/mir/ops/ScaleOp.h b/compiler/mir/include/mir/ops/ScaleOp.h
deleted file mode 100644 (file)
index a9bcf1d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-
-#ifndef _MIR_OPS_SCALE_OP_H_
-#define _MIR_OPS_SCALE_OP_H_
-
-#include "mir/Operation.h"
-
-namespace mir
-{
-namespace ops
-{
-
-class ScaleOp : public Operation
-{
-public:
-  ScaleOp(Output *arg1, Output *arg2) : Operation(Type::scale, {arg1, arg2})
-  {
-    // Infer output shape.
-    setOutputShape(0, getInputShape(0));
-  }
-
-  Operation *copyWithInputs(const std::vector<Output *> &inputs) override
-  {
-    return new ScaleOp(inputs[0], inputs[1]);
-  }
-};
-
-} // namespace ops
-} // namespace mir
-
-#endif //_MIR_OPS_SCALE_OP_H_
index 8a78bd5..1daa427 100644 (file)
 
 #include "mir/IrDotDumper.h"
 
-#include "mir/ops/BatchNormOp.h"
-#include "mir/ops/BiasAddOp.h"
-#include "mir/ops/CappedReluOp.h"
-#include "mir/ops/ConcatOp.h"
-#include "mir/ops/ConstantOp.h"
-#include "mir/ops/Conv2DOp.h"
-#include "mir/ops/Deconv2DOp.h"
-#include "mir/ops/DepthwiseConv2DOp.h"
-#include "mir/ops/DropoutOp.h"
-#include "mir/ops/ElementwiseOp.h"
-#include "mir/ops/EluOp.h"
-#include "mir/ops/FullyConnectedOp.h"
-#include "mir/ops/GatherOp.h"
-#include "mir/ops/GemmOp.h"
-#include "mir/ops/InputOp.h"
-#include "mir/ops/LeakyReluOp.h"
-#include "mir/ops/OutputOp.h"
-#include "mir/ops/PadOp.h"
-#include "mir/ops/PoolOp.h"
-#include "mir/ops/ReduceOp.h"
-#include "mir/ops/ReluOp.h"
-#include "mir/ops/ReshapeOp.h"
-#include "mir/ops/ResizeOp.h"
-#include "mir/ops/ScaleOp.h"
-#include "mir/ops/SigmoidOp.h"
-#include "mir/ops/SliceOp.h"
-#include "mir/ops/SoftmaxOp.h"
-#include "mir/ops/SqrtOp.h"
-#include "mir/ops/SqueezeOp.h"
-#include "mir/ops/TanhOp.h"
-#include "mir/ops/TransposeOp.h"
-
-#include <iostream>
+#include "mir/OpDefs.h"
+
 #include <map>
 
 namespace mir
@@ -74,16 +43,6 @@ static std::vector<Shape> getOutputShapes(const Operation &op)
   return shapes;
 }
 
-void IrDotDumper::visit(ops::BiasAddOp &op)
-{
-  auto nodeInfo = DotIrNodeInfo()
-                      .withType("BiasAdd", op.getName())
-                      .withInShapes(getInputShapes(op))
-                      .withOutShapes(getOutputShapes(op));
-
-  _dot_builder.updateWithOp(&op, nodeInfo);
-}
-
 void IrDotDumper::visit(ops::CappedReluOp &op)
 {
   auto nodeInfo = DotIrNodeInfo()
@@ -229,15 +188,6 @@ void IrDotDumper::visit(ops::BatchNormOp &op)
   _dot_builder.updateWithOp(&op, nodeInfo);
 }
 
-void IrDotDumper::visit(ops::ScaleOp &op)
-{
-  auto nodeInfo = DotIrNodeInfo()
-                      .withType("ScaleOp", op.getName())
-                      .withInShapes(getInputShapes(op))
-                      .withOutShapes(getOutputShapes(op));
-  _dot_builder.updateWithOp(&op, nodeInfo);
-}
-
 void IrDotDumper::visit(ops::SliceOp &op)
 {
   auto node_info = DotIrNodeInfo()
index b97c6e4..135d81c 100644 (file)
  */
 
 #include "mir/Operation.h"
-#include "mir/ops/AddOp.h"
-#include "mir/ops/BatchNormOp.h"
-#include "mir/ops/BiasAddOp.h"
-#include "mir/ops/CappedReluOp.h"
-#include "mir/ops/ConcatOp.h"
-#include "mir/ops/ConstantOp.h"
-#include "mir/ops/Conv2DOp.h"
-#include "mir/ops/Deconv2DOp.h"
-#include "mir/ops/DepthwiseConv2DOp.h"
-#include "mir/ops/DivOp.h"
-#include "mir/ops/DropoutOp.h"
-#include "mir/ops/ElementwiseOp.h"
-#include "mir/ops/EluOp.h"
-#include "mir/ops/FullyConnectedOp.h"
-#include "mir/ops/GatherOp.h"
-#include "mir/ops/GemmOp.h"
-#include "mir/ops/InputOp.h"
-#include "mir/ops/LeakyReluOp.h"
-#include "mir/ops/MaxOp.h"
-#include "mir/ops/MulOp.h"
-#include "mir/ops/OutputOp.h"
-#include "mir/ops/PadOp.h"
-#include "mir/ops/PoolOp.h"
-#include "mir/ops/ReduceOp.h"
-#include "mir/ops/ReluOp.h"
-#include "mir/ops/ReshapeOp.h"
-#include "mir/ops/ResizeOp.h"
-#include "mir/ops/ScaleOp.h"
-#include "mir/ops/SigmoidOp.h"
-#include "mir/ops/SliceOp.h"
-#include "mir/ops/SoftmaxOp.h"
-#include "mir/ops/SqueezeOp.h"
-#include "mir/ops/SqrtOp.h"
-#include "mir/ops/SubOp.h"
-#include "mir/ops/TanhOp.h"
-#include "mir/ops/TransposeOp.h"
+#include "mir/OpDefs.h"
 
 namespace mir
 {