convert-to-uff failed to parse Conv2D

tf_node: name: “stack”
op: “Pack”
input: “stack/0_1”
input: “stack/1_1”
input: “stack/2”
input: “stack/3”
attr {
key: “N”
value {
i: 4
}
}
attr {
key: “T”
value {
type: DT_INT32
}
}
attr {
key: “_output_shapes”
value {
list {
shape {
dim {
size: 4
}
dim {
size: 2
}
}
}
}
}
attr {
key: “axis”
value {
i: 0
}
}
attr {
key: “value”
value {
}
}

Traceback (most recent call last):
File “uff_custom_plugin.py”, line 206, in
main()
File “uff_custom_plugin.py”, line 197, in main
uff_path = model_to_uff(MODEL_PATH)
File “uff_custom_plugin.py”, line 146, in model_to_uff
quiet=False
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py”, line 132, in from_tensorflow
name=“main”)
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 78, in convert_tf2uff_graph
uff_graph, input_replacements)
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 65, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes)
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 44, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py”, line 270, in convert_conv2d
return _conv2d_helper(name, tf_node, inputs, uff_graph, func=“conv2d”, **kwargs)
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py”, line 286, in _conv2d_helper
tf_node, inputs, kwargs[“tf_nodes”])
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 169, in apply_fused_padding
p = cls.convert_tf2numpy_const_node(tf_padding_node)
File “/home/tongbei/software/anaconda2/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py”, line 152, in convert_tf2numpy_const_node
return array.reshape(shape)
ValueError: cannot reshape array of size 0 into shape ()

Hello, to help us debug, can you please share a small repro with the source and model that exhibit the errors you are seeing.

convert-to-uff failed to parse the following operation:

l = tf.pad.(image, tf.stack([[0,0], [0,0], maybe_reverse_pad(2, 3+ pad_shape2d[0]), maybe_reverse_pad(2, 3 + pad_shape2d[1])]))

def maybe_reverse_pad(topleft, bottomright):
if config.TF_PAD_MODE:
return [topleft, bottomright]
return [bottomright, topleft]

Particularly, convert-to-uff failed to parse this node:
tf_node: name: “stack”
op: “Pack”
input: “stack/0_1”
input: “stack/1_1”
input: “stack/2”
input: “stack/3”

It is a input of the node “Pad”:
tf_lhs_node: name: “Pad”
op: “Pad”
input: “transpose”
input: “stack”
attr {
key: “T”
value {
type: DT_FLOAT
}
}
attr {
key: “Tpaddings”
value {
type: DT_INT32
}
}
attr {
key: “_output_shapes”
value {
list {
shape {
dim {
size: -1
}
dim {
size: 3
}
dim {
size: -1
}
dim {
size: -1
}
}
}
}
}

I have checked the source code of convert-to-uff parser. To parse the node “Pad” correctly, it assumes that the second input is a “Padding” type Const node.

So do you have any solutions to solve this problem?
stack.png