You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/07/03 06:31:29 UTC

[GitHub] [incubator-tvm] anijain2305 commented on a change in pull request #5976: MXNet frontend support for AMP cast op

anijain2305 commented on a change in pull request #5976:
URL: https://github.com/apache/incubator-tvm/pull/5976#discussion_r449399713



##########
File path: python/tvm/relay/frontend/mxnet.py
##########
@@ -903,6 +903,22 @@ def _mx_resize(inputs, attrs):
     return _op.image.resize(inputs[0], size,
                             coordinate_transformation_mode="align_corners")
 
+def _mx_amp_multicast(inputs, attrs):
+    cast_narrow = attrs.get_bool("cast_narrow", False)
+    dtypes = [_infer_type(x).checked_type.dtype for x in inputs]
+    supported_dtypes = ['float16', 'float32']
+    assert all([x in supported_dtypes for x in dtypes]), \
+            "amp_multicast support is limited to float16 and float32 inputs only."
+    dtype = 'float32' if cast_narrow else dtypes[0]

Review comment:
       Just a minor and soft suggestion, so feel free to ignore.  Maybe following has better readability
   
   ~~~
   has_float16 = any(x == "float16" for x in dtypes)
   has_float32 = any(x == "float32" for x in dtypes)
   
   # logic with three vars - cart_narrow, has_float16, has_float32
   ~~~
   
   




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