快捷方式

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

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲取問題解答

檢視資源