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_r191953906
 
 

 ##########
 File path: python/mxnet/contrib/onnx/_import/translation_utils.py
 ##########
 @@ -148,21 +152,25 @@ 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
+        reshape_shape = tuple(reshape_shape)
+        op_sym = symbol.reshape(inputs[1], shape=reshape_shape)
         if op_name == 'broadcast_add':
-            op_sym = symbol.broadcast_add(op_sym, inputs[0])
+            op_sym = symbol.broadcast_add(inputs[0], op_sym)
         elif op_name == 'broadcast_mul':
 
 Review comment:
   done

----------------------------------------------------------------
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

Reply via email to