Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input with dynamic dimensions for depthwise_conv2d #1961

Open
tdsuper opened this issue Jun 9, 2022 · 2 comments
Open

input with dynamic dimensions for depthwise_conv2d #1961

tdsuper opened this issue Jun 9, 2022 · 2 comments
Assignees
Labels
need investigation Need investigation

Comments

@tdsuper
Copy link

tdsuper commented Jun 9, 2022

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.

@hwangdeyu
Copy link
Contributor

hwangdeyu commented Jun 10, 2022

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?

@hwangdeyu hwangdeyu added the pending on user response Waiting for more information or validation from user label Jun 10, 2022
@hwangdeyu hwangdeyu self-assigned this Jun 10, 2022
@tdsuper
Copy link
Author

tdsuper commented Jun 15, 2022

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.

@fatcat-z fatcat-z added need investigation Need investigation and removed pending on user response Waiting for more information or validation from user labels Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need investigation Need investigation
Projects
None yet
Development

No branches or pull requests

3 participants