The array API specification stipulates that the operators logical_(and|not|or|xor) should accept one scalar the same way arithmetic functions do.
PyTorch currently does not support that, although the magic methods seem to work just fine:
import torch
a = torch.tensor(True)
b = True
assert a & b
assert torch.logical_and(a, b)
tensor(True)
TypeError: logical_and(): argument 'other' (position 2) must be Tensor, not bool
cc @mruberry @rgommers @pmeier
The array API specification stipulates that the operators
logical_(and|not|or|xor)should accept one scalar the same way arithmetic functions do.PyTorch currently does not support that, although the magic methods seem to work just fine:
cc @mruberry @rgommers @pmeier