Added logical operators that return non-ByteTensors
The existing equality operators always return ByteTensors. Often the
return values from an equality operation needs to be used with a tensor
of the original type (e.g. point-wise multiplication with a mask), and
the ByteTensor therefore has to be cast back to this type. This casting
is unneccessary, and for CudaTensors would be costly, as it involves a
round-trip to the host.
This commit adds new forms of the equality operators that directly
writes the result into a tensor of the approriate type. For example
x = torch.DoubleTensor(5)
y = torch.rand(5)
x:lt(y,0.5)
The existing ByteTensor-returning forms are still present.
1 file changed