[soft_backend] Added Resize shape checking (#7107)
authorПавел Ильютченко/AI Tools Lab /SRR/Engineer/삼성전자 <p.iliutchenk@samsung.com>
Tue, 3 Sep 2019 17:03:19 +0000 (20:03 +0300)
committerAlexander Efimov/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Tue, 3 Sep 2019 17:03:19 +0000 (20:03 +0300)
* Checked that resize work only H and W dims

Signed-off-by: Pavel Iliutchenko <p.iliutchenk@samsung.com>
compiler/nnc/passes/soft_backend/ModelAnalyzer.cpp

index a7e637f..b4c025a 100644 (file)
@@ -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: