• 文档 >
  • torch >
  • torch.tanh
快捷键

torch.tanh

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

返回一个新张量,其元素为 input 的双曲正切值。

outi=tanh(inputi)\text{out}_{i} = \tanh(\text{input}_{i})
参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> a = torch.randn(4)
>>> a
tensor([ 0.8986, -0.7279,  1.1745,  0.2611])
>>> torch.tanh(a)
tensor([ 0.7156, -0.6218,  0.8257,  0.2553])

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源