anirudh2290 commented on a change in pull request #11106: [ONNX] Added
Unsqueeze operator import support
URL: https://github.com/apache/incubator-mxnet/pull/11106#discussion_r192886205
##########
File path: python/mxnet/contrib/onnx/_import/op_translations.py
##########
@@ -386,6 +386,15 @@ def squeeze(attrs, inputs, cls):
mxnet_op = symbol.split(mxnet_op, axis=i-1, num_outputs=1,
squeeze_axis=1)
return mxnet_op, new_attrs, inputs
+def unsqueeze(attrs, inputs, cls):
+ """Inserts a new axis of size 1 into the array shape"""
+ # 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)
Review comment:
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) ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services