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, optional) – 輸出張量 (可選)。 範例 >>> 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 函式庫,該函式庫會將非常大的結果四捨五入到無窮大或負無窮大。有關詳細資訊,請參閱此處。