-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels