Suppose x
is a tensor in Pytorch. One can either write:
x_lowerthanzero = x.lt(0)
or:
x_lowerthanzero = (x<0)
with seemingly the exact same results. Many other operations have Pytorch built-in equivalents: x.gt(0)
for (x>0)
, x.neg()
for -x
, x.mul()
etc.
Is there a good reason to use one form over the other?