评价此页

Identity#

class torch.nn.Identity(*args, **kwargs)[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])