Shortcuts

身份

class torch.nn.Identity(*args, **kwargs)[源代码]

一个占位符身份操作符,对参数不敏感。

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

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

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

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

示例:

>>> 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])
优云智算