You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases NumPy and PyTorch raise different exception classes: numpy raises a ValueError or TypeError, while pytorch defaults to RuntimeError.
For instance (this one is straight from the numpy test suite) subtracting booleans :
In [12]: a = np.ones((), dtype=np.bool_); a - a
Input In [12], in <cell line: 1>()
----> 1 a = np.ones((), dtype=np.bool_); a - a
TypeError: numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
The matching pytorch call raises a RuntmeError.
For the time being, I'm adding a raises((TypeError, RuntimeError)) in the test suite, with an intention to revisit this later, and either translate exceptions everywhere, or just document the difference.
The text was updated successfully, but these errors were encountered:
In some cases NumPy and PyTorch raise different exception classes: numpy raises a ValueError or TypeError, while pytorch defaults to RuntimeError.
For instance (this one is straight from the numpy test suite) subtracting booleans :
The matching pytorch call raises a RuntmeError.
For the time being, I'm adding a
raises((TypeError, RuntimeError))
in the test suite, with an intention to revisit this later, and either translate exceptions everywhere, or just document the difference.The text was updated successfully, but these errors were encountered: