torch.deg2rad — PyTorch 2.5 documentation (original) (raw)

Shortcuts

torch.deg2rad(input, *, out=None) → Tensor

Returns a new tensor with each of the elements of inputconverted from angles in degrees to radians.

Parameters

input (Tensor) – the input tensor.

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example:

a = torch.tensor([[180.0, -180.0], [360.0, -360.0], [90.0, -90.0]]) torch.deg2rad(a) tensor([[ 3.1416, -3.1416], [ 6.2832, -6.2832], [ 1.5708, -1.5708]])