Open leezu opened 4 years ago
mx.np.broadcast_arrays(mx.np.ones((1,)), mx.np.arange(10, dtype=int))
works correctly.
The reason that this bug is important: When writing a HybridBlock, the dtype of some input array depends on the user. But some other internally used array may have a fixed dtype that could be unequal of the input dtype. Workaround is to add an extra cast prior to broadcast_like.
Since this issue has 2 parts:
this issue is related to an op that is deprecated in 2.0, so I'm marking this as 1.x. this issue is probably not a good first issue without pointers on where to look to address it.
Description
broadcast_like
"Broadcasts lhs to have the same shape as rhs." Thus only the shape information of lhs and rhs array should matter. However, it also asserts that the dtypes are equal.Error Message
To Reproduce
mx.nd.broadcast_like(mx.nd.ones((1,)), mx.nd.arange(10, dtype=int))