You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/05/30 17:58:10 UTC

[GitHub] Roshrini commented on a change in pull request #10605: [MXNET-310] [ONNX-MXNet] API to import ONNX models into Gluon.

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

 ##########
 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:
   Calling "_fix_broadcast()" function for all broadcast_add, broadcast_sub, broadcast_mul, broadcast_div operations.
   Here, you are handling only broadcas_add and broadcast_mul

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services