Rate this Page
โ˜… โ˜… โ˜… โ˜… โ˜…

torch.cos#

torch.cos(input, *, out=None) โ†’ Tensor#

Returns a new tensor with the cosine of the elements of input.

outi=cosโก(inputi)\text{out}_{i} = \cos(\text{input}_{i})
Parameters

input (Tensor) โ€“ the input tensor.

Keyword Arguments

out (Tensor, optional) โ€“ the output tensor.

Example:

>>> a = torch.randn(4)
>>> a
tensor([ 1.4309,  1.2706, -0.8562,  0.9796])
>>> torch.cos(a)
tensor([ 0.1395,  0.2957,  0.6553,  0.5574])