快捷方式

Identity

class torch.nn.Identity(*args, **kwargs)[source][source]

一个占位符恒等运算符,对参数不敏感。

参数
  • args (Any) – 任何参数(未使用)

  • kwargs (Any) – 任何关键字参数(未使用)

形状
  • 输入: ()(*), 其中 * 表示任意数量的维度。

  • 输出: ()(*), 与输入形状相同。

示例

>>> m = nn.Identity(54, unused_argument1=0.1, unused_argument2=False)
>>> input = torch.randn(128, 20)
>>> output = m(input)
>>> print(output.size())
torch.Size([128, 20])

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源