From d2e617e23330cbb3943e5a020264b9dca55ab9bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=98=D0=BB=D1=8C=D1=8E?= =?utf8?q?=D1=82=D1=87=D0=B5=D0=BD=D0=BA=D0=BE/AI=20Tools=20Lab=20/SRR/Eng?= =?utf8?q?ineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 3 Sep 2019 20:03:19 +0300 Subject: [PATCH] [soft_backend] Added Resize shape checking (#7107) * Checked that resize work only H and W dims Signed-off-by: Pavel Iliutchenko --- compiler/nnc/passes/soft_backend/ModelAnalyzer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/nnc/passes/soft_backend/ModelAnalyzer.cpp b/compiler/nnc/passes/soft_backend/ModelAnalyzer.cpp index a7e637f..b4c025a 100644 --- a/compiler/nnc/passes/soft_backend/ModelAnalyzer.cpp +++ b/compiler/nnc/passes/soft_backend/ModelAnalyzer.cpp @@ -352,6 +352,15 @@ void ModelAnalyzer::visit(ops::ReshapeOp &op) { appendOperationToInference(&op, void ModelAnalyzer::visit(mir::ops::ResizeOp &op) { + const auto &in_shape = op.getInputShape(0); + const auto &out_shape = op.getOutputShape(0); + + assert(in_shape.rank() == 4); + assert(in_shape.rank() == out_shape.rank()); + + if (in_shape.dim(0) != out_shape.dim(0) || in_shape.dim(3) != out_shape.dim(3)) + throw std::runtime_error("Not supported Resize on other dims besides height and width!"); + switch (op.getMode()) { case mir::ops::ResizeOp::ResizeMethod::nearestNeighbor: -- 2.7.4