Is there the Pi greek (3.1415...) defined somewhere?

as in title. Is it defined?

I need this value in order to implement a custom loss function. Right now I am using:

PI=torch.acos(torch.Tensor([-1]))

Thank you!

Hi,

You have it in the python math library. But we don’t have a special one in pytorch, you will need to create a tensor with it.

import math
print(torch.Tensor([math.pi]))
1 Like