[BE] enable UFMT for torch/nn/functional.py (#128592)

Part of #123062

- #123062

Pull Request resolved: https://github.com/pytorch/pytorch/pull/128592
Approved by: https://github.com/mikaylagawarecki
ghstack dependencies: #128596, #128594
This commit is contained in:
Xuehai Pan
2024-06-17 03:58:20 +08:00
committed by PyTorch MergeBot
parent 95ac2d6482
commit f6e6e55fa7
18 changed files with 1360 additions and 492 deletions

View File

@ -11,7 +11,10 @@ from torch.overrides import handle_torch_function, has_torch_function
def get_approximate_basis(
A: Tensor, q: int, niter: Optional[int] = 2, M: Optional[Tensor] = None
A: Tensor,
q: int,
niter: Optional[int] = 2,
M: Optional[Tensor] = None,
) -> Tensor:
"""Return tensor :math:`Q` with :math:`q` orthonormal columns such
that :math:`Q Q^H A` approximates :math:`A`. If :math:`M` is
@ -180,7 +183,10 @@ def _svd_lowrank(
def pca_lowrank(
A: Tensor, q: Optional[int] = None, center: bool = True, niter: int = 2
A: Tensor,
q: Optional[int] = None,
center: bool = True,
niter: int = 2,
) -> Tuple[Tensor, Tensor, Tensor]:
r"""Performs linear Principal Component Analysis (PCA) on a low-rank
matrix, batches of such matrices, or sparse matrix.