Reshape inputs size should be compatible

Hi , I have facing one problem , I’m running the “Compile Tensorflow Models” tutorial demo code, it’s okay with the given model which is InceptionV1 from “https://github.com/dmlc/web-data/tree/master/tensorflow/models/InceptionV1” , But when I test my model which is InceptionV4, it brings Error as follow:
nnvm._base.NNVMError: Error in operator prefix/InceptionV4/Logits/PreLogitsFlatten/flatten/Reshape: [09:00:52] /tvm/nnvm/src/top/tensor/transform.cc:649: Check failed: in_attrs->at(0).Size() == in_attrs->at(1).Size() (1536 vs. 2) Reshape inputs size should be compatible
The inputs of reshape op with shapes (1,1,1,1536) and 2
output shape is (?,?)
Could you please tell why did the error happened?

Please refer.

Cross Ref. https://github.com/dmlc/tvm/issues/1972#issuecomment-432889737

The explanation here slightly slippery, feel free to ask if not clear.

Above shape incompatibility is due usage of reshape_like instead of reshape as a fallback. Using reshape_like was an old approach where the Shape operator was a bypass.

Recent changes of for Shape operator converts Shape output to a parameter.

Current open PR handles a case where Shape is already a param but there are few ops between Shape param and Reshape input. Hence we infer the shape param here by running a sub graph on Reshape argument.

1 Like

Thank you for your reply, it takes me much time to understand what happened in there.
I’m still kind of confused of this , My original Reshape input are [1,1,1,1536] and [1,-1], if reshape_like require the size of them should be compatible. How do I to change the [1,-1] ?

It’s reshape we call here not reshape_like.

-1 indicate to auto compute the shape. In this case source size if 1536, hence the output shape for [1, -1] becomes [1, 1536].

1 Like