From: 박천교/On-Device Lab(SR)/Engineer/삼성전자 Date: Tue, 30 Jul 2019 07:55:32 +0000 (+0900) Subject: [moco-tf] Reshape shape inference rejects dynamic case (#6013) X-Git-Tag: submit/tizen/20190809.050447~326 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f59a406faf08dce6415a29d7844585ddda28db6;p=platform%2Fcore%2Fml%2Fnnfw.git [moco-tf] Reshape shape inference rejects dynamic case (#6013) Previously shape inference stage for TFReshape node was erroneously done for wildcard dimension as well. This commit fixes this bug to reject dynamic reshape case. Signed-off-by: Cheongyo Bahk --- diff --git a/compiler/moco-tf/src/Transforms/FixShapeTransform.cpp b/compiler/moco-tf/src/Transforms/FixShapeTransform.cpp index 23275df..72cb3e4 100644 --- a/compiler/moco-tf/src/Transforms/FixShapeTransform.cpp +++ b/compiler/moco-tf/src/Transforms/FixShapeTransform.cpp @@ -990,7 +990,14 @@ bool fix_shape(moco::tf::TFReshape *node) shape_data.rank(shape_rank); for (uint32_t axis = 0; axis < shape_rank; ++axis) { - shape_data.dim(axis) = const_shape_input->at(axis); + auto shape_dim = const_shape_input->at(axis); + if (shape_dim == -1) + { + // Reshape's new shape has wildcard dimension, i.e. dynamic reshape + return false; + } + assert(shape_dim >= 1); + shape_data.dim(axis) = shape_dim; } // TODO Compare 'tensor' input and validate coherency?