Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Regarding "Reshape layer can't be resized" from the OpenVino docs

AGaru
Beginner
556 Views

Hi!

The doc states that: "Models with fixed dimensions in the dim attribute of the Reshape layer can't be resized".

1) How do I understand, if my Reshape layer has fixed dim or not?

2) Has that restriction been fixed in any version of OpenVino?

3) I have a problem: reshaping for my model raises exception in the method ReshapeShapeProp::inferShapesImpl: "Invalid reshape mask (dim attribute): number of elements in input ..." in OpenVino 2018 R5. Looks like reshaping doesn't work for the Reshape. The failing node is described that way:

		<layer id="116" name="hidden_name/DimData_const" precision="FP32" type="Const">
			<output>
				<port id="1">
					<dim>2</dim>
				</port>
			</output>
			<blobs>
				<custom offset="7604932" size="8"/>
			</blobs>
		</layer>
		<layer id="117" name="hidden_name" precision="FP32" type="Reshape">
			<input>
				<port id="0">
					<dim>1</dim>
					<dim>56</dim>
					<dim>56</dim>
					<dim>3</dim>
				</port>
				<port id="1">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="2">
					<dim>1</dim>
					<dim>9408</dim>
				</port>
			</output>
		</layer>

When it tries to reshape, the input becomes 1x128x128x3 (or any other size), but the ouput remains 1x9408, thus it fails size check. Do you have any advice on what can cause this?

It worked fine in OpenVino 2018 R4 though. The model has been reexported for R5 (from onnx).

 

Thank you!

0 Kudos
1 Reply
Shubha_R_Intel
Employee
556 Views

Dear Garustovich, Alexander,

First it appears that you are using a very old version of OpenVino. We are all the way up to 2019R1.1 now, so please upgrade.

So the limitation you describe regarding models with fixed dims not being re-shape-able is still a limitation according to This doc . The limitation is really in the Reshape Layer of Inference Engine and it makes sense when you really think about it.

To answer your first question:

1) How do I understand, if my Reshape layer has fixed dim or not? This Tensorflow article about dynamic vs static shapes explains it. The article encourages you to stick with dynamic shapes when you build models but sometimes people don't do that. When a shape is "static" in Tensorflow then that is an example of what Inference Engine would infer to be " a fixed dim". 

I hope this answers your questions.

Thanks,

Shubha

 

 

 

0 Kudos
Reply