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 2021/02/24 19:49:57 UTC

[GitHub] [tvm] mbrookhart opened a new pull request #7519: fix datatype on Reciprocal op

mbrookhart opened a new pull request #7519:
URL: https://github.com/apache/tvm/pull/7519


   cc @jwfromm 
   
   I only enabled the fp16 test on Reciprocal because the llvm backend doesn't support some of the trig ops with fp16
   


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



[GitHub] [tvm] jwfromm merged pull request #7519: [ONNX]fix datatype on Reciprocal op

Posted by GitBox <gi...@apache.org>.
jwfromm merged pull request #7519:
URL: https://github.com/apache/tvm/pull/7519


   


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



[GitHub] [tvm] jwfromm commented on a change in pull request #7519: [ONNX]fix datatype on Reciprocal op

Posted by GitBox <gi...@apache.org>.
jwfromm commented on a change in pull request #7519:
URL: https://github.com/apache/tvm/pull/7519#discussion_r583264216



##########
File path: tests/python/frontend/onnx/test_forward.py
##########
@@ -1867,6 +1867,23 @@ def verify_unary_ops(op, x, rtol=1e-5, atol=1e-5):
     verify_unary_ops("Sigmoid", x)
     verify_unary_ops("Softsign", x)
 
+    def verify_unary_ops_fp16(op, x, rtol=1e-5, atol=1e-5):
+        z = helper.make_node(op, ["in1"], ["out"])
+        graph = helper.make_graph(
+            [z],
+            "_test",
+            inputs=[
+                helper.make_tensor_value_info("in1", TensorProto.FLOAT16, list(in_shape)),
+            ],
+            outputs=[helper.make_tensor_value_info("out", TensorProto.FLOAT16, list(out_shape))],
+        )
+        model = helper.make_model(graph, producer_name="_test")
+        verify_with_ort_with_inputs(model, [x], rtol=rtol, atol=atol)
+
+    dtype = "float16"
+    x = np.random.uniform(size=in_shape).astype(dtype)
+    verify_unary_ops_fp16("Reciprocal", x)
+

Review comment:
       I think you could pretty cleanly fuse this into `verify_unary_ops` by adding an optional `dtype` argument. You can use `mapping.NP_TYPE_TO_TENSOR_TYPE[np.dtype(dtype)]` to convert that dtype string into the proper ONNX proto type.




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