torch.cosh¶ torch.cosh(input, *, out=None) → Tensor¶ 返回一個新張量,其中每個元素是 input 中對應元素的雙曲餘弦。 outi=cosh(inputi)\text{out}_{i} = \cosh(\text{input}_{i}) outi=cosh(inputi) 引數 input (Tensor) – 輸入張量。 關鍵字引數 out (Tensor, 可選的) – 輸出張量。 示例 >>> a = torch.randn(4) >>> a tensor([ 0.1632, 1.1835, -0.6979, -0.7325]) >>> torch.cosh(a) tensor([ 1.0133, 1.7860, 1.2536, 1.2805]) 注意 當 input 在 CPU 上時,torch.cosh 的實現可能會使用 Sleef 庫,該庫會將非常大的結果四捨五入到正無窮或負無窮。詳情請參閱 此處。