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