tensorflow-onnx
tensorflow-onnx copied to clipboard
input with dynamic dimensions for depthwise_conv2d
I am trying to convert a tensorflow model with depthwise_conv2d operation to onnx.
However, if the input has dynamic dimensions such as tf.placeholder(tf.float32, [1, None, None, 3], name='input'), tf2onnx will report error input channel must be positive.
I have also tried to specify the width and height of input, tf2onnx can succefully convert the model. It seems like that k_input_channels corresponds to the channels dimension of input. But I do not know why k_input_channels would be -1 for the input with dynamic dimensions.
I do not know whether the depthwise convolution does not support dynamic input currently or I have missed something.
Yes, DepthwiseConv2d op can support the height and width dimensions as dynamic.
It only checks if the input channel dimension >=1. In the exmaple tf.placeholder(tf.float32, [1, None, None, 3], name='input'), the channel size == 3 so tf2onnx shouldn't throw this error.
Could you shard the reproduction code then we can help you to take a look at what's happened?
Hi, the model I tried to convert is from the checkpoints of SingleHDR, which calls tf.image.sobel_edges. From the source of tensorflow, I found the implementation of tf.image.sobel_edges contains depthwise_conv2d operation.