Forums - 4D to 2D conversion and back is not supported

3 posts / 0 new
Last post
4D to 2D conversion and back is not supported
CN
Join Date: 8 Sep 17
Posts: 12
Posted: Fri, 2017-09-08 02:49
Conversion from 4D to 2D and back is unsupported: I run into issues where the first dimension seems to be reserved as the batch dimension only.
 
Here is simple TensorFlow code which is stand-alone and produces the issue. It classifies MNIST, data is automatically downloaded. The ProtoBuf graph is automatically created by the code. Here is the code:
 
 
The command I used to create the DLC is:
snpe-tensorflow-to-dlc --graph graph.pb --input_dim input 28,28,1 --out_node output --dlc graph.dlc
The message I get from the tool is:
~/snpe-1.4.0/lib/python/converters/tensorflow/layers/reshape.py:83: RuntimeWarning: error_code=1004; error_message=Layer parameters combination is invalid. Layer reshape/4d_to_2d: tensor size mismatch between input {28, 28, 1} and output {1}; error_component=Model Validation; line_no=130; thread_id=139684032206592 output_name)
~/snpe-1.4.0/lib/python/converters/tensorflow/layers/reshape.py:83: RuntimeWarning: error_code=1004; error_message=Layer parameters combination is invalid. Layer reshape/2d_to_4d: tensor size mismatch between input {1} and output {28, 28, 1}; error_component=Model Validation; line_no=130; thread_id=139684032206592 output_name)
 
  • Up0
  • Down0
dmarques
Join Date: 15 Sep 17
Posts: 27
Posted: Fri, 2017-09-15 12:40

Hello CN,

SNPE does not currently support 4D input tensors (batched inputs). You may want to try the following with a single element in the batch dimension:

snpe-tensorflow-to-dlc --graph graph.pb --input_dim input 28,28,1 --out_node output --dlc graph.dlc --allow_unconsumed_nodes

  • Up0
  • Down0
CN
Join Date: 8 Sep 17
Posts: 12
Posted: Tue, 2017-09-19 00:59

Not sure how to proceed here. I tried with batch size of one and with "--allow_unconsumed_nodes", but the warning message doesn't change. When running the network with the provided example Android application it still crashes at runtime with more or less the same message:

09-19 09:57:34.345 22122-22169/com.qualcomm.qti.snpe.imageclassifiers E/LoadNetworkTask: Unable to create network! Cause: error_code=1004; error_message=Layer parameters combination is invalid. Layer reshape/4d_to_2d: tensor size mismatch between input {28, 28, 1} and output {1}; error_component=Model Validation; line_no=130; thread_id=-677381856
                                                                                         java.lang.IllegalStateException: Unable to create network! Cause: error_code=1004; error_message=Layer parameters combination is invalid. Layer reshape/4d_to_2d: tensor size mismatch between input {28, 28, 1} and output {1}; error_component=Model Validation; line_no=130; thread_id=-677381856
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.