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])