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

torch.ldexp

torch.ldexp(input, other, *, out=None) Tensor

input 乘以 2 的 other 次方。

outi=inputi2iother\text{{out}}_i = \text{{input}}_i * 2^\text{{other}}_i

通常这个函数用于通过将 input 中的尾数相乘,并与由 other 中的指数创建的 2 的整数次幂相乘来构造浮点数。

参数:
  • input (Tensor) – 输入张量。

  • 其他(张量)- 指数张量,通常是整数。

关键字参数:

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

示例:

>>> torch.ldexp(torch.tensor([1.]), torch.tensor([1]))
tensor([2.])
>>> torch.ldexp(torch.tensor([1.0]), torch.tensor([1, 2, 3, 4]))
tensor([ 2.,  4.,  8., 16.])

© 版权所有 PyTorch 贡献者。

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

文档

PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源