-
Notifications
You must be signed in to change notification settings - Fork 434
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
Fix None shape error when one input to ConcatV2 has a shape. #2135
Conversation
I tried to convert a network where one of the inputs to a concatenation along dimension -1 had shape None. The other input did however have a shape. The conversion failed because the code only looked att the shape of the first input to determine what positive axis value to use in the concatenation. If the order of the inputs had been reversed, the conversion would have worked. I have now changed the code to look at the shapes of both input nodes. With the new code, I can convert the network. I have also verified that the resulting onnx-file works. Signed-off-by: Klas Magnusson <[email protected]>
87fc6eb
to
314e8f1
Compare
Thanks for your contributions! @klasma , |
…ape. In the test, a tensor with none shape is created by applying the slice operator to another tensor. The slice size is obtained by adding two tensors and therefore the size of the sliced tensor cannot be inferred and is set to None. A tensor with a known shape is then concatenated to the tensor with none shape along the -1 axis. Previously, it was not possible to convert a network with this structure, but I fixed that bug in my previous commit. The problem occurred only when the first input had none shape and when the concatenation axis was -1. Signed-off-by: Klas Magnusson <[email protected]>
… fix-none-shape-concatenation
…sma/tensorflow-onnx into fix-none-shape-concatenation
Sorry for the delay. I had to do some additional debugging in order to reproduce the problem in a test. Now I have added a test for this scenario to test_backend.py. In the test, a tensor with none shape is created by applying the slice operator to another tensor. The slice size is obtained by adding two tensors and therefore the shape of the sliced tensor cannot be inferred and is set to None. A tensor with a known shape is then concatenated to the tensor with none shape along the -1 axis. This is the node structure that caused problems in the network that I was trying to convert. Let me know if you have any questions or if there is something else that I should do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contribution!
I tried to convert a network where one of the inputs to a concatenation along dimension -1 had shape None. The other input did however have a shape. The conversion failed because the code only looked att the shape of the first input to determine what positive axis value to use in the concatenation. If the order of the inputs had been reversed, the conversion would have worked.
I have now changed the code to look at the shapes of both input nodes. With the new code, I can convert the network. I have also verified that the resulting onnx-file works.
Let me know if you would like me to change or add something.