anirudhacharya commented on a change in pull request #10605: [MXNET-310]
[ONNX-MXNet] API to import ONNX models into Gluon.
URL: https://github.com/apache/incubator-mxnet/pull/10605#discussion_r192205144
##########
File path: python/mxnet/contrib/onnx/_import/translation_utils.py
##########
@@ -148,21 +152,29 @@ def _fix_bias(op_name, attrs, num_inputs):
raise ValueError("Unexpected number of inputs for: {}".format(op_name))
return attrs
-def _fix_bias_shape(op_name, inputs, cls):
+def _fix_broadcast(op_name, inputs, broadcast_axis, cls):
"""A workaround to reshape bias term to (1, num_channel)."""
if int(len(cls._params)) > 0:
assert len(list(inputs)) == 2
- op_sym = symbol.reshape(inputs[1], shape=(1, -1, 1, 1))
+ input0_shape = get_input_shape(inputs[0], cls)
+ #creating reshape shape
+ reshape_shape = list(len(input0_shape) * (1,))
+ reshape_shape[broadcast_axis] = -1
Review comment:
yes, broadcast_axis comes from the ONNX's axis attribute in operators that
support broadcasting -
https://github.com/onnx/onnx/blob/master/docs/Changelog.md#attributes-103
----------------------------------------------------------------
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