LinearTransformation¶
- class torchvision.transforms.v2.LinearTransformation(transformation_matrix: Tensor, mean_vector: Tensor)[源代码]¶
使用离线计算的方形变换矩阵和均值向量变换张量图像或视频。
此变换不支持 PIL 图像。给定 transformation_matrix 和 mean_vector,将展平 torch.*Tensor 并从中减去 mean_vector,然后计算与 transformation_matrix 的点积,最后将张量重塑为其原始形状。
- 应用
白化变换:假设 X 是一个列向量零均值数据。然后使用 torch.mm(X.t(), X) 计算数据协方差矩阵 [D x D],对此矩阵执行 SVD 并将其作为 transformation_matrix 传递。
- 参数:
transformation_matrix (Tensor) – 张量 [D x D],D = C x H x W
mean_vector (Tensor) – 张量 [D],D = C x H x W