gmalivenko/onnx2keras

Dynamic shapes

alexg93333 opened this issue · 0 comments

I am trying to convert an onnx model with dynamic input shape : ['p2o.DynamicDimension.0', 3, 'p2o.DynamicDimension.1', 'p2o.DynamicDimension.2'] .

Traceback (most recent call last):
File "/home/dockerpaddle/Desktop/onnx/test.py", line 11, in
k_model = onnx_to_keras(onnx_model, ['x'])
File "/home/dockerpaddle/.local/lib/python3.10/site-packages/onnx2keras/converter.py", line 175, in onnx_to_keras
AVAILABLE_CONVERTERS[node_type](
File "/home/dockerpaddle/.local/lib/python3.10/site-packages/onnx2keras/convolution_layers.py", line 177, in convert_conv
layers[node_name] = conv(input_0)
File "/home/dockerpaddle/.local/lib/python3.10/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/dockerpaddle/.local/lib/python3.10/site-packages/tensorflow/python/framework/ops.py", line 1967, in _create_c_op
raise ValueError(e.message)
ValueError: Exception encountered when calling layer "conv2d_218.tmp_0" (type Conv2D).

Negative dimension size caused by subtracting 3 from 2 for '{{node conv2d_218.tmp_0/Conv2D}} = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 1, 2, 2], use_cudnn_on_gpu=true](Placeholder, conv2d_218.tmp_0/Conv2D/ReadVariableOp)' with input shapes: [?,3,2,2], [3,3,3,8].

Call arguments received by layer "conv2d_218.tmp_0" (type Conv2D):
• inputs=tf.Tensor(shape=(None, 3, 2, 2), dtype=float32)

Running into this error.