身份 ¶
- class torch.nn.Identity(*args, **kwargs)[source][source]¶
一个对参数不敏感的占位符身份操作符。
- 参数:
任意参数(未使用)
任意关键字参数(未使用)
- 形状:
输入: ,其中 表示任意数量的维度。
输出: ,与输入具有相同的形状。
示例:
>>> 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])