Closed
Description
numpy and PyTorch diverge on the zero division behavior of integral dtype
's:
>>> a1 = np.array(1, dtype=np.int)
>>> a2 = np.array(0, dtype=np.int)
>>> a1 // a2
0
>>> a1 % a2
0
>>> t1 = torch.tensor(1, dtype=torch.int)
>>> t2 = torch.tensor(0, dtype=torch.int)
>>> t1 // t2
RuntimeError: ZeroDivisionError
>>> t1 % t2
RuntimeError: ZeroDivisionError
We should either specify the behavior or fix the test suite to exclude zero as second input when testing these functions. cc @asmeurer