The torch.cos () function provides support for the cosine function in PyTorch. It expects input in radians, and output is in the range [-1, 1]. Input type — tensor, and if the input contains more than one element, the element-wise cosine is calculated.
Syntax : torch.cos (x, out = None)
Parameters : x : Input tensor name (optional): Output tensor
Return type : A tensor with the same type as that of x.