-
Notifications
You must be signed in to change notification settings - Fork 433
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
Conversion of tranpose into reshape goes wrong after 3D NDHWC convolution #1464
Comments
Okay, I checked master and it looks like this may already be fixed in master. |
Thanks for the bug report. We just overhauled the transpose optimizer so as you said, it might already be fixed. You can install the latest tf2onnx from master with |
I tried, but I am getting the following exception now:
|
For me
|
Interesting. It works on my machine. What TF version are you using? I didn't realize structured_input_signature could contain non-TensorSpec objects. |
It was my actual implementation that threw that error, not the bug reproduce. Example:
yields: I think you want to check for |
Got it. #1490 |
That fixed it, thanks! |
When doing a 3D NDHWC convolution with an optional bias and element-wise operation after it (for example sigmoid), the second transpose (after the convolution) is incorrect. It has 4 dimensions where it should have 5.
Futhermore the optimization crashes if
biases = 1.0
in my example (it assumes a numpy array).Reproduce:
I traced it back to the
_switch_transpose_and_node
method in theTransposeOptimizer
. It always does aNHWC_TO_NCHW
permutation where-as it should check the rank as in_handle_node_having_branches
. So:should be:
It seems that in a lot of places it's still assumed that the graph is a 2D convolutional network, where-as of course convolutions can be of any dimension. I'd like to raise awareness because 3D convolutions are widely used in medical machine learning. Also, for audio 1D convolutions are often used.
Furthermore, it would be nice if optimizations could be disabled (perhaps on a per-optimization basis). The optimizations can be finicky and are not strictly necessary to get an ONNX conversion. I think ideally the optimizer is a separate tool altogether (so that it works on any ONNX).
The text was updated successfully, but these errors were encountered: