-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[ONNX] Added Unsqueeze operator import support #11106
Conversation
# MXNet can only add one axis at a time. | ||
mxnet_op = inputs[0] | ||
for axis in attrs["axes"]: | ||
mxnet_op = symbol.expand_dims(mxnet_op, axis=axis) |
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.
can axes have repeats ?
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.
there is no restriction on repeats.the logic would still work. I tested it , it works fine.
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.
What is the expectation of how unsqueeze should work with repeats ? if unsqueeze called with attrs(1, 1) and tensor of shape(1, 2) should it return a tensor of shape (1,1,1,2) or (1,1,2) ?
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.
return tensor shape (1,1,1,2).
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.
okay!
@@ -106,6 +106,16 @@ def test_squeeze(): | |||
output = mxnet_backend.run_node(node_def, [input1])[0] | |||
npt.assert_almost_equal(output, np.squeeze(input1, axis=[1, 3])) | |||
|
|||
@with_seed() |
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.
can we not use the backend tests added to the fw here: https://github.com/onnx/onnx/pull/497/files
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.
Yes, i can enable that. I will wait for #10605 to merge and then add appropriately ( as it modifies test files)
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.
Enabled ONNX backend test for Unsqueeze
* Unsqueeze operator support * Enabled unsqeeze test in ONNX test framework
* Unsqueeze operator support * Enabled unsqeeze test in ONNX test framework
Description
ONNX Unsqueeze op maps to expand dims. Added the support.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments
@anirudhacharya @anirudh2290 @lupesko