Forums - Conv2DTranspose support in SNPE converter to .dlc

4 posts / 0 new
Last post
Conv2DTranspose support in SNPE converter to .dlc
marouane.berrada
Join Date: 13 Oct 21
Posts: 4
Posted: Wed, 2021-10-13 10:19

Hello,

 

I am new in SNPE SDK and I am trying to convert a model writen in Keras 2.30-tf  / Tensorflow 2.2  from .pb format into .dlc

using snpe-tensorflow-to-dlc. The .dlc file generation completes  with the following WARNING :

WARNING_TF_OP_NOT_SUPPORTED: Operation (dummy_convnet/convT1/Shape) of type (Shape) is not supported by converter.

I get the following error with the dummy model here below which has a Conv2DTranspose Layer that seems to cause the issue.

The SNPE SDK documentation specifies that conv2d_transpose  is supported, is there an issue with TF2.2 Conv2DTranspose  Layer ?

>>>>>>>>>>

def gen_dummy_convnet(model_name):
    image_size = 256
    filters = 32
    kernel_size = 3
    inputs = tf.keras.layers.Input(shape=[image_size, image_size, 3] , name = "in_img")
    x = tf.keras.layers.Conv2D(filters, kernel_size, strides=2, padding='same', name="conv1")(inputs)
    x = tf.keras.layers.Conv2DTranspose(filters=filters, kernel_size=kernel_size, strides=2, padding='same', name="convT1")(x)
    x = tf.keras.layers.ReLU(name="out_img")(x)
    return tf.keras.Model(inputs=inputs, outputs=x, name = model_name)

>>>>>>>>>>

 

  • Up0
  • Down0
marouane.berrada
Join Date: 13 Oct 21
Posts: 4
Posted: Fri, 2021-10-15 02:06

I did not get any reply so far but I've made some progress but still facing some issues.
The dummy model containing a Conv2D Layer was written in Keras/TF2.2.0 and converted to a frozen model in .pb format.
Then I used SNPE v 1.51.0 using TF1.15  to convert it to a .dlc file , and that produced the WARNING_TF_OP_NOT_SUPPORTED mentioned above 

In order to avoid compatibility issues , I used TF2.2.0 also to do the .pb => .dlc conversion (same version as used to generate the .pb).

Now I have an error during the .pb => .dlc conversion

>>>>>>>>>>>

Traceback (most recent call last):
  File "/home/renault/Venv/tf2.2.0/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 6404, in not_equal
    incompatible_shape_error)
tensorflow.python.eager.core._FallbackException: This function does not handle the case of the path where all inputs are not already EagerTensors.
 
During handling of the above exception, another exception occurred:
.....
ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: <tf.Tensor 'dummy_convnet/conv1/BiasAdd:0' shape=(None, 128, 128, 32) dtype=float32>
INFO: Setup convert-to-dlc completed.

>>>>>>>>>>>
It tells me that the Tensor at the input of my Conv2D Layer should be of int32 type, but it should be a float32, How can it be int32, all neural networks manipulate floats and matmul operations. What do you think is the issue here ?. 

 

  • Up0
  • Down0
marouane.berrada
Join Date: 13 Oct 21
Posts: 4
Posted: Fri, 2021-10-15 02:35

Just to summary my configurations :

Keras to generate (and train) the model : 2.3.0-tf

tensorflow for converted .keras model file to .pb :   2.2.0 

To convert .pb to .dlc:

ubuntu-18 LTS , SNPE:  snpe-1.51.0

Tried 2 options : 

tensorflow:  1.15.0 and python 3.6.9  (Got the WARNING_TF_OP_NOT_SUPPORTED)

- tensorflow:  2.2.0 and python 3.6.9 (Got the ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32)

  • Up0
  • Down0
marouane.berrada
Join Date: 13 Oct 21
Posts: 4
Posted: Fri, 2021-10-15 02:36

Just to summary my configurations :

Keras to generate (and train) the model : 2.3.0-tf

tensorflow for converted .keras model file to .pb :   2.2.0 

To convert .pb to .dlc:

ubuntu-18 LTS , SNPE:  snpe-1.51.0

Tried 2 options : 

tensorflow:  1.15.0 and python 3.6.9  (Got the WARNING_TF_OP_NOT_SUPPORTED)

- tensorflow:  2.2.0 and python 3.6.9 (Got the ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32)

  • 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.