From 629af1c4f0ed47a9d0ed4278772c54bf169006a3 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 03:33:55 +0900 Subject: [PATCH] [mir] Remove Dropout operation (#6675) This is a no-op in inference mode. Signed-off-by: Sergei Barannikov --- compiler/mir/include/mir/IrDotDumper.h | 1 - compiler/mir/include/mir/OpDefs.h | 1 - compiler/mir/include/mir/Operations.inc | 1 - compiler/mir/include/mir/ops/DropoutOp.h | 53 -------------------------------- compiler/mir/src/IrDotDumper.cpp | 10 ------ 5 files changed, 66 deletions(-) delete mode 100644 compiler/mir/include/mir/ops/DropoutOp.h diff --git a/compiler/mir/include/mir/IrDotDumper.h b/compiler/mir/include/mir/IrDotDumper.h index c029981..3c44277 100644 --- a/compiler/mir/include/mir/IrDotDumper.h +++ b/compiler/mir/include/mir/IrDotDumper.h @@ -36,7 +36,6 @@ public: void visit(ops::Conv2DOp &op) override; void visit(ops::DeConv2DOp &op) override; void visit(ops::DepthwiseConv2DOp &op) override; - void visit(ops::DropoutOp &op) override; void visit(ops::EluOp &op) override; void visit(ops::FullyConnectedOp &op) override; void visit(ops::GatherOp &op) override; diff --git a/compiler/mir/include/mir/OpDefs.h b/compiler/mir/include/mir/OpDefs.h index 3040d24..7d73d50 100644 --- a/compiler/mir/include/mir/OpDefs.h +++ b/compiler/mir/include/mir/OpDefs.h @@ -26,7 +26,6 @@ #include "mir/ops/Deconv2DOp.h" #include "mir/ops/DepthwiseConv2DOp.h" #include "mir/ops/DivOp.h" -#include "mir/ops/DropoutOp.h" #include "mir/ops/EluOp.h" #include "mir/ops/FullyConnectedOp.h" #include "mir/ops/GatherOp.h" diff --git a/compiler/mir/include/mir/Operations.inc b/compiler/mir/include/mir/Operations.inc index 3a6b98e..e0acb21 100644 --- a/compiler/mir/include/mir/Operations.inc +++ b/compiler/mir/include/mir/Operations.inc @@ -26,7 +26,6 @@ HANDLE_OP(conv2D, Conv2DOp) HANDLE_OP(deConv2D, DeConv2DOp) HANDLE_OP(depthwiseConv, DepthwiseConv2DOp) HANDLE_OP(div, DivOp) -HANDLE_OP(dropout, DropoutOp) HANDLE_OP(ELU, EluOp) HANDLE_OP(fullyConnected, FullyConnectedOp) HANDLE_OP(gather, GatherOp) diff --git a/compiler/mir/include/mir/ops/DropoutOp.h b/compiler/mir/include/mir/ops/DropoutOp.h deleted file mode 100644 index 4ebbe76..0000000 --- a/compiler/mir/include/mir/ops/DropoutOp.h +++ /dev/null @@ -1,53 +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_DROPOUT_OP_H_ -#define _MIR_OPS_DROPOUT_OP_H_ - -#include "mir/Operation.h" - -namespace mir -{ -namespace ops -{ - -class DropoutOp : public Operation -{ -public: - DropoutOp(Output *arg, float rate) : Operation(Type::dropout, {arg}), _rate(rate) - { - // Infer output shape. - setOutputShape(0, getInputShape(0)); - } - - Operation *copyWithInputs(const std::vector &inputs) override - { - return new DropoutOp(inputs[0], _rate); - } - - /** - * @return The ratio of random dropout - */ - float getRate() const { return _rate; } - -private: - float _rate; -}; - -} // namespace ops -} // namespace mir - -#endif //_MIR_OPS_DROPOUT_OP_H_ diff --git a/compiler/mir/src/IrDotDumper.cpp b/compiler/mir/src/IrDotDumper.cpp index df0220e..a683107 100644 --- a/compiler/mir/src/IrDotDumper.cpp +++ b/compiler/mir/src/IrDotDumper.cpp @@ -179,16 +179,6 @@ void IrDotDumper::visit(ops::SliceOp &op) _dot_builder.updateWithOp(&op, node_info); } -void IrDotDumper::visit(ops::DropoutOp &op) -{ - auto nodeInfo = DotIrNodeInfo() - .withType("DropoutOp", op.getName()) - .withInShapes(getInputShapes(op)) - .withOutShapes(getOutputShapes(op)) - .withMisc("DropRate", op.getRate()); - _dot_builder.updateWithOp(&op, nodeInfo); -} - void IrDotDumper::visit(ops::DeConv2DOp &op) { auto node_info = DotIrNodeInfo() -- 2.7.4