From 6500ff69b333f55c81ff98c76de646ea41e36205 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: Thu, 5 Sep 2019 19:18:05 +0300 Subject: [PATCH] [mir] Make Shape constructor explicit (#7239) Make `Shape` constructor explicit again. Signed-off-by: Sergei Barannikov --- compiler/mir/include/mir/Shape.h | 3 +-- compiler/mir/src/IrDotDumper.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/mir/include/mir/Shape.h b/compiler/mir/include/mir/Shape.h index 18fa812..f3082e8 100644 --- a/compiler/mir/include/mir/Shape.h +++ b/compiler/mir/include/mir/Shape.h @@ -40,8 +40,7 @@ public: Shape(std::initializer_list &&dims) : _dims(std::move(dims)) {} - // TODO Make it 'explicit'. - Shape(const std::vector &dims) : _dims(std::begin(dims), std::end(dims)) {} + explicit Shape(const std::vector &dims) : _dims(std::begin(dims), std::end(dims)) {} int32_t rank() const { return static_cast(_dims.size()); } diff --git a/compiler/mir/src/IrDotDumper.cpp b/compiler/mir/src/IrDotDumper.cpp index d4eab84..a58cd5a 100644 --- a/compiler/mir/src/IrDotDumper.cpp +++ b/compiler/mir/src/IrDotDumper.cpp @@ -84,7 +84,7 @@ void IrDotDumper::visit(ops::Conv2DOp &op) .withType("Conv2D") .withInShapes(getInputShapes(op)) .withOutShapes(getOutputShapes(op)) - .withStride(op.getStrides()) + .withStride(Shape(op.getStrides())) .withShape("Padding before", Shape(op.getPaddingBefore())) .withShape("Padding after", Shape(op.getPaddingAfter())); @@ -97,7 +97,7 @@ void IrDotDumper::visit(ops::DepthwiseConv2DOp &op) .withType("DepthwiseConv2D") .withInShapes(getInputShapes(op)) .withOutShapes(getOutputShapes(op)) - .withStride(op.getStrides()) + .withStride(Shape(op.getStrides())) .withShape("Padding before", Shape(op.getPaddingBefore())) .withShape("Padding after", Shape(op.getPaddingAfter())); @@ -198,7 +198,7 @@ void IrDotDumper::visit(ops::DeConv2DOp &op) .withInShapes(getInputShapes(op)) .withOutShapes(getOutputShapes(op)) .withPadType(op.getPaddingType()) - .withStride(op.getStrides()); + .withStride(Shape(op.getStrides())); _dot_builder.updateWithOp(&op, node_info); } -- 2.7.4