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 2021/02/04 05:06:33 UTC

[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19837: [v1.x] Onnx Support for Dropout

Zha0q1 commented on a change in pull request #19837:
URL: https://github.com/apache/incubator-mxnet/pull/19837#discussion_r569949526



##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -1125,16 +1125,19 @@ def convert_dropout(node, **kwargs):
     opset_version = kwargs["opset_version"]
 
     probability = float(attrs.get("p", 0.5))
+    axes = convert_string_to_list((attrs.get("axes", "None")))
+    mode = attrs.get('mode', 'training')
 
-    if opset_version >= 12:
-        # opset >= 12 requires the ratio to be an input
-        nodes = [
-            create_const_scalar_node(name+"_ratio0", np.float32(probability), kwargs),
-            make_node("Dropout", [input_nodes[0], name+"_ratio0"], [name], name=name)
-        ]
-        return nodes
-    else:
-        return [make_node("Dropout", input_nodes, [name], ratio=probability, name=name)]
+    if axes != [None]:

Review comment:
       convert_string_to_list() will return [None] if input is 'None'

##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -1125,16 +1125,19 @@ def convert_dropout(node, **kwargs):
     opset_version = kwargs["opset_version"]
 
     probability = float(attrs.get("p", 0.5))
+    axes = convert_string_to_list((attrs.get("axes", "None")))

Review comment:
       Good catch!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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