torch.cos

torch.cos(input, *, out=None) Tensor

返回一个新张量,其中包含张量元素的余弦值。

$\text{out}_{i} = \cos(\text{input}_{i})$
参数

input (Tensor) – 需要输入的张量。

关键字参数

out (Tensor, 可选) – 指定输出张量。

示例:

>>> 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])
本页目录