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 2019/01/09 01:09:51 UTC

[GitHub] vandanavk commented on a change in pull request #13806: ONNX ops: norm exported and lpnormalization imported

vandanavk commented on a change in pull request #13806: ONNX ops: norm exported and lpnormalization imported
URL: https://github.com/apache/incubator-mxnet/pull/13806#discussion_r246223070
 
 

 ##########
 File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
 ##########
 @@ -1689,3 +1689,41 @@ def convert_logsoftmax(node, **kwargs):
         name=name
     )
     return [node]
+
+@mx_op.register("norm")
+def convert_norm(node, **kwargs):
+    """Map MXNet's norm operator attributes to onnx's ReduceL1 and ReduceL2 operators
+    and return the created node.
+    """
+    name, input_nodes, attrs = get_inputs(node, kwargs)
+
+    mx_axis = attrs.get("axis", None)
+    axes = convert_string_to_list(str(mx_axis)) if mx_axis is not None else None
+
+    keepdims = get_boolean_attribute_value(attrs, "keepdims")
+    ord = int(attrs.get("ord", 2))
+
+    if ord == 1:
+        onnx_op_name = "ReduceL1"
+    else:
+        onnx_op_name = "ReduceL2"
+
+    if axes is not None:
 
 Review comment:
   if axes:

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