🚀 Feature
Currently, only torch.sum and torch.mean have multi-dimension reductions. It would be nice to extend this property to reduction operations such as torch.prod, torch.all and torch.any. This will also ensure that the interface is similar to NumPy, which supports this.
The current alternative to doing multi-dim reductions is to chain the operations like so:
import torch
x = torch.randn(2, 3, 5)
x.prod(-1).prod(-1) # can be replaced by x.prod(dim=(-1, -2))
y = torch.randint(2, (2, 3, 5), dtype=bool)
y.all(-1).all(-1) # can be replaced by y.all(dim=(-1, -2))
# analogously for torch.any
🚀 Feature
Currently, only
torch.sumandtorch.meanhave multi-dimension reductions. It would be nice to extend this property to reduction operations such astorch.prod,torch.allandtorch.any. This will also ensure that the interface is similar to NumPy, which supports this.The current alternative to doing multi-dim reductions is to chain the operations like so: