快捷方式

LinearTransformation

torchvision.transforms.LinearTransformation(transformation_matrix, mean_vector)[原始碼]

使用離線計算的方陣變換矩陣和均值向量對 Tensor 影像進行變換。此變換不支援 PIL Image。給定 transformation_matrix 和 mean_vector,將展平 torch.*Tensor 並從中減去 mean_vector,然後計算與變換矩陣的點積,最後將 Tensor 重塑回其原始形狀。

應用

白化變換:假設 X 是一個列向量零中心化資料。然後使用 torch.mm(X.t(), X) 計算資料協方差矩陣 [D x D],對此矩陣執行 SVD,並將其作為 transformation_matrix 傳遞。

引數:
  • transformation_matrix (Tensor) – Tensor [D x D],其中 D = C x H x W

  • mean_vector (Tensor) – Tensor [D],其中 D = C x H x W

forward(tensor: Tensor) Tensor[原始碼]
引數:

tensor (Tensor) – 待白化的 Tensor 影像。

返回:

變換後的影像。

返回型別:

Tensor

文件

訪問 PyTorch 的完整開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源