[mir] Remove BatchNorm op (#6465)
authorСергей Баранников/AI Tools Lab /SRR/Engineer/삼성전자 <s.barannikov@samsung.com>
Fri, 9 Aug 2019 20:10:19 +0000 (23:10 +0300)
committerAlexander Efimov/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Fri, 9 Aug 2019 20:10:19 +0000 (23:10 +0300)
Remove BatchNorm operation which has never been used.

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/BatchNormOp.h [deleted file]
compiler/mir/src/IrDotDumper.cpp

index 3e3eca2..0a09ffa 100644 (file)
@@ -30,7 +30,6 @@ namespace mir
 class IrDotDumper : public IVisitor
 {
 public:
-  void visit(ops::BatchNormOp &op) override;
   void visit(ops::CappedReluOp &op) override;
   void visit(ops::ConcatOp &op) override;
   void visit(ops::ConstantOp &op) override;
index cdd3d71..57e2f8d 100644 (file)
@@ -18,7 +18,6 @@
 #define _MIR_OPDEFS_H_
 
 #include "mir/ops/AddOp.h"
-#include "mir/ops/BatchNormOp.h"
 #include "mir/ops/CappedReluOp.h"
 #include "mir/ops/CommonProps.h"
 #include "mir/ops/ConcatOp.h"
index 9c15b30..736b14c 100644 (file)
@@ -19,7 +19,6 @@
 #endif // HANDLE_OP
 
 HANDLE_OP(add, AddOp)
-HANDLE_OP(batchNorm, BatchNormOp)
 HANDLE_OP(cappedReLU, CappedReluOp)
 HANDLE_OP(concat, ConcatOp)
 HANDLE_OP(constant, ConstantOp)
diff --git a/compiler/mir/include/mir/ops/BatchNormOp.h b/compiler/mir/include/mir/ops/BatchNormOp.h
deleted file mode 100644 (file)
index d69d570..0000000
+++ /dev/null
@@ -1,69 +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_BATCH_NORM_H_
-#define _MIR_OPS_BATCH_NORM_H_
-
-#include "mir/Operation.h"
-
-namespace mir
-{
-namespace ops
-{
-
-class BatchNormOp : public Operation
-{
-public:
-  BatchNormOp(Output *arg, float moving_avg_fraction, float eps, bool spatial)
-      : Operation(Type::batchNorm, {arg}), _moving_avg_fraction(moving_avg_fraction), _eps(eps),
-        _spatial(spatial)
-  {
-    // Infer output shape.
-    setOutputShape(0, getInputShape(0));
-  }
-
-  Operation *copyWithInputs(const std::vector<Output *> &inputs) override
-  {
-    return new BatchNormOp(inputs[0], _moving_avg_fraction, _eps, _spatial);
-  }
-
-  /**
-   * @return The epsilon value to use to avoid division by zero.
-   */
-  float getEps() const { return _eps; }
-
-  /**
-   * @return Factor used in computing the running mean and variance.
-   * e.g., running_mean = running_mean * movingAvgFraction + mean * (1 - movingAvgFraction).
-   */
-  float getMovingAvgFraction() const { return _moving_avg_fraction; }
-
-  /**
-   * @return If true, compute the mean and variance across all spatial elements If false, compute
-   * the mean and variance per feature.
-   */
-  bool getSpatial() const { return _spatial; }
-
-private:
-  float _moving_avg_fraction;
-  float _eps;
-  bool _spatial;
-};
-
-} // namespace ops
-} // namespace mir
-
-#endif //_MIR_OPS_BATCH_NORM_H_
index c4e3a33..6185cc7 100644 (file)
@@ -176,18 +176,6 @@ void IrDotDumper::visit(ops::ConstantOp &op)
   _dot_builder.updateWithOp(&op, node_info);
 }
 
-void IrDotDumper::visit(ops::BatchNormOp &op)
-{
-  auto nodeInfo = DotIrNodeInfo()
-                      .withType("BatchNorm", op.getName())
-                      .withInShapes(getInputShapes(op))
-                      .withOutShapes(getOutputShapes(op))
-                      .withMisc("Moving Average Fraction", op.getMovingAvgFraction())
-                      .withMisc("Eps", op.getEps())
-                      .withMisc("Spatial", op.getSpatial());
-  _dot_builder.updateWithOp(&op, nodeInfo);
-}
-
 void IrDotDumper::visit(ops::SliceOp &op)
 {
   auto node_info = DotIrNodeInfo()