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 库,该库会将非常大的结果四舍五入到正无穷或负无穷。详情请参阅 此处。