[BE] Ensure generated stub files by gen_pyi are properly formatted (#150730)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/150730
Approved by: https://github.com/aorenste
This commit is contained in:
Xuehai Pan
2025-05-17 14:29:21 +08:00
committed by PyTorch MergeBot
parent 7ebea09986
commit 27f7b65a69
5 changed files with 84 additions and 31 deletions

View File

@ -10550,7 +10550,8 @@ Example:
... [[ 0.2035, 1.2959, 1.8101, -0.4644],
... [ 1.5027, -0.3270, 0.5905, 0.6538],
... [-1.5745, 1.3330, -0.5596, -0.6548],
... [ 0.1264, -0.5080, 1.6420, 0.1992]])
... [ 0.1264, -0.5080, 1.6420, 0.1992]]
... ) # fmt: skip
>>> torch.std(a, dim=1, keepdim=True)
tensor([[1.0311],
[0.7477],
@ -10608,7 +10609,8 @@ Example:
... [[ 0.2035, 1.2959, 1.8101, -0.4644],
... [ 1.5027, -0.3270, 0.5905, 0.6538],
... [-1.5745, 1.3330, -0.5596, -0.6548],
... [ 0.1264, -0.5080, 1.6420, 0.1992]])
... [ 0.1264, -0.5080, 1.6420, 0.1992]]
... ) # fmt: skip
>>> torch.std_mean(a, dim=0, keepdim=True)
(tensor([[1.2620, 1.0028, 1.0957, 0.6038]]),
tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]]))
@ -11896,7 +11898,8 @@ Example:
... [[ 0.2035, 1.2959, 1.8101, -0.4644],
... [ 1.5027, -0.3270, 0.5905, 0.6538],
... [-1.5745, 1.3330, -0.5596, -0.6548],
... [ 0.1264, -0.5080, 1.6420, 0.1992]])
... [ 0.1264, -0.5080, 1.6420, 0.1992]]
... ) # fmt: skip
>>> torch.var(a, dim=1, keepdim=True)
tensor([[1.0631],
[0.5590],
@ -11953,7 +11956,8 @@ Example:
... [[ 0.2035, 1.2959, 1.8101, -0.4644],
... [ 1.5027, -0.3270, 0.5905, 0.6538],
... [-1.5745, 1.3330, -0.5596, -0.6548],
... [ 0.1264, -0.5080, 1.6420, 0.1992]])
... [ 0.1264, -0.5080, 1.6420, 0.1992]]
... ) # fmt: skip
>>> torch.var_mean(a, dim=0, keepdim=True)
(tensor([[1.5926, 1.0056, 1.2005, 0.3646]]),
tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]]))