wkcn commented on a change in pull request #17977: Relaxing type requirements 
for broadcast_like
URL: https://github.com/apache/incubator-mxnet/pull/17977#discussion_r404043791
 
 

 ##########
 File path: tests/python/unittest/test_operator.py
 ##########
 @@ -3119,6 +3119,15 @@ def test_reshape_like_different_types():
     z = mx.nd.reshape_like(x, y)
     assert_allclose(z.asnumpy(), [[0,0],[0,0],[0,0]])
 
+@with_seed()
+def test_broadcast_like_different_types():
+    x = mx.nd.zeros((2, 1))
+    y = mx.nd.ones((2, 2))
+
+    y = mx.nd.array(y).astype('int32')
+    z = mx.nd.broadcast_like(x, y)
+    assert_allclose(z.asnumpy(), [[0,0],[0,0]])
 
 Review comment:
   It is better to add the assertion `assert x.dtype == z.dtype`.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to