How to calculate the square of a tensor?

just like numpy.square in numpy.
Thank you very much

Assume a tensor A, the the square of A equals A * A, that is B = A * A

You should also be able to do A**2 or A.pow(2)

1 Like

There is also a torch.square function now (PR) that you can call like A.square().