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
Hi, I just want to ask if it is contribute welcome for adding two boolean reduce operations torch.all and torch.any. The API is the the same as torch.sum and torch.prod. These two ops treat the input tensor as boolean tensor and compute the and and or along the the specified dimension.
torch.all can be implemented as torch.prod, but implementing torch.any as torch.sum is dangerous because it is possible that there happen to be 256 1s in the tensor, which would gives a 0 instead of some non-zero value and in my application, I'm using a workaround for torch.any that looks like
torch.sum(x.dtype(torch.float), dim) >0
The text was updated successfully, but these errors were encountered:
We already have them, although they are present only as methods of Boolean tensors (.all(), .any()). Since they’re limited to a single type only I think it’s better to avoid adding them to the main namespace. Thanks for the proposal!
Hi, I just want to ask if it is contribute welcome for adding two boolean reduce operations
torch.all
andtorch.any
. The API is the the same astorch.sum
andtorch.prod
. These two ops treat the input tensor as boolean tensor and compute theand
andor
along the the specified dimension.torch.all
can be implemented astorch.prod
, but implementingtorch.any
astorch.sum
is dangerous because it is possible that there happen to be 256 1s in the tensor, which would gives a 0 instead of some non-zero value and in my application, I'm using a workaround fortorch.any
that looks likeThe text was updated successfully, but these errors were encountered: