快捷方式

torch.cos

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

返回一個新張量,其中包含 input 中元素的餘弦值。

outi=cos(inputi)\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])

文件

獲取 PyTorch 的完整開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源