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

torch.full_like

torch.full_like(input, fill_value, \*, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) Tensor

返回一个与 input 大小相同的张量,填充 fill_value . torch.full_like(input, fill_value) 等同于 torch.full(input.size(), fill_value, dtype=input.dtype, layout=input.layout, device=input.device) .

参数:
  • 输入(张量)- input 的大小将决定输出张量的大小。

  • 填充值 - 用于填充输出张量的数字。

关键字参数:
  • dtype( torch.dtype ,可选)- 返回张量的期望数据类型。默认:如果 None ,则默认为 input 的数据类型。

  • layout( torch.layout ,可选)- 返回张量的期望布局。默认:如果 None ,则默认为 input 的布局。

  • 返回张量的期望设备( torch.device ,可选)- 默认:如果 None ,则默认为 input 的设备。

  • requires_grad (bool,可选) – 如果 autograd 应记录对返回张量的操作。默认: False

  • 返回张量的期望内存格式( torch.memory_format ,可选)- 默认: torch.preserve_format


© 版权所有 PyTorch 贡献者。

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

文档

PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源