Identity¶ class torch.nn.Identity(*args, **kwargs)[source][source]¶ 一个不关心参数的占位符 identity 操作符。 参数 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])