From: Павел Ильютченко/AI Tools Lab /SRR/Engineer/삼성전자
Date: Wed, 19 Dec 2018 12:17:20 +0000 (+0300)
Subject: [nnc] Fix strided slice shrink axis mask (#2725)
X-Git-Tag: nncc_backup~1042
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e359d85de5c31eeee59eb8f132fcb51a26e5c41;p=platform%2Fcore%2Fml%2Fnnfw.git
[nnc] Fix strided slice shrink axis mask (#2725)
* Fix processing shrink axis mask on StridedSlice operation creation on TFLite importer
Signed-off-by: Pavel Iliutchenko
---
diff --git a/contrib/nnc/passes/tflite_frontend/tflite_op_creator.cpp b/contrib/nnc/passes/tflite_frontend/tflite_op_creator.cpp
index 66c0943..02e2e48 100644
--- a/contrib/nnc/passes/tflite_frontend/tflite_op_creator.cpp
+++ b/contrib/nnc/passes/tflite_frontend/tflite_op_creator.cpp
@@ -480,21 +480,24 @@ TFLiteOpCreator::createStridedSlice(InputOps& inputs, const InputParams& params,
Shape start(num_dims);
Shape size(num_dims);
+ std::vector squeeze_dims;
for (int axis = 0; axis < num_dims; axis++) {
if (begin_mask & (1 << axis))
start.dim(axis) = 0;
else
start.dim(axis) = begin.at(Index{axis});
+
if (end_mask & (1 << axis))
size.dim(axis) = inputs[0]->getOutputShape(0).dim(axis) - start.dim(axis);
else
size.dim(axis) = end.at(Index{axis}) - start.dim(axis);
+
+ if (shrink_axis_mask & (1 << axis))
+ squeeze_dims.push_back(axis);
}
- std::vector squeeze_dims{shrink_axis_mask - 1};
-
auto slice_outputs = createOp(ActivationFunctionType_NONE,
- inputs[0]->getOutput(0), start, size);
+ inputs[0]->getOutput(0), start, size);
return createOp(ActivationFunctionType_NONE,
slice_outputs[0]->getOutput(0), squeeze_dims);
}