Anndrey24 commented on code in PR #17007:
URL: https://github.com/apache/tvm/pull/17007#discussion_r1606992341


##########
tests/python/topi/test_topi_conv2d_nhwc.py:
##########
@@ -104,14 +104,36 @@ def ref_data(dtype, batch, in_channel, in_size, 
num_filter, kernel, stride, padd
     a_shape = (batch, in_height, in_width, in_channel)
     w_shape = (kernel, kernel, in_channel, num_filter)
 
+    np.random.seed(0)
     a_np = np.random.uniform(size=a_shape).astype(dtype)
     w_np = np.random.uniform(size=w_shape).astype(dtype)
     dw_np = tvm.topi.testing.dilate_python(w_np, (dilation, dilation, 1, 1))
-    b_np = tvm.topi.testing.conv2d_nhwc_python(a_np, dw_np, stride, padding)
+
+    # scipy.signal.convolve2d does not support float16 data types,
+    # and the python fallback would be too slow for general use.
+    conv_dtype = "float32" if dtype == "float16" else dtype

Review Comment:
   Yes, currently it would always be "float32". I was thinking that if 
"float64" test cases were added in the future, there would be no need to change 
`ref_data()` since `scipy.signal.convolve2d` does support that data type, so I 
tried to specifically highlight "float16" as an exception to the rule.
   
   Regarding guarding the fp16 execution, I agree that it should just build if 
the compilation target has the `+fullfp16` feature but the execution platform 
doesn't. I'll make the change.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to