From: A. Unique TensorFlower Date: Mon, 12 Mar 2018 17:24:56 +0000 (-0700) Subject: Convert Squeeze into Reshape: Support empty output shapes. X-Git-Tag: tflite-v0.1.7~201^2~1^2~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31af33430d3edbfdecbcf121681e5a586f37ba03;p=platform%2Fupstream%2Ftensorflow.git Convert Squeeze into Reshape: Support empty output shapes. PiperOrigin-RevId: 188740288 --- diff --git a/tensorflow/contrib/lite/toco/graph_transformations/convert_squeeze_to_reshape.cc b/tensorflow/contrib/lite/toco/graph_transformations/convert_squeeze_to_reshape.cc index e601284..81cedb5 100644 --- a/tensorflow/contrib/lite/toco/graph_transformations/convert_squeeze_to_reshape.cc +++ b/tensorflow/contrib/lite/toco/graph_transformations/convert_squeeze_to_reshape.cc @@ -57,6 +57,11 @@ bool ConvertSqueezeToReshape::Run(Model* model, std::size_t op_index) { // We use the output shape that has been calculated by shape propagation. const auto& output_shape = model->GetArray(squeeze_op->outputs[0]).shape(); + // Empty shapes will not work as empty data arrays. + if (output_shape.dimensions_count() == 0) { + return false; + } + auto* reshape_op = new TensorFlowReshapeOperator; reshape_op->inputs = { squeeze_op->inputs[0],