[reland] Allow setting grad_dtype on leaf tensors (#164751)

ghstack-source-id: e44b3941530be83a630ec93f1478eec741ffca2e
Pull-Request-resolved: https://github.com/pytorch/pytorch/pull/162815

Fixes #ISSUE_NUMBER

Relanding due to internal weirdness. Separate PR to codev w/o ghstack.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164751
Approved by: https://github.com/albanD
This commit is contained in:
soulitzer
2025-10-08 20:23:13 +00:00
committed by PyTorch MergeBot
parent 001e1d2637
commit 71aefd5595
20 changed files with 377 additions and 41 deletions

View File

@ -1351,6 +1351,7 @@ def get_testing_overrides() -> dict[Callable, Callable]:
Tensor._grad.__get__: lambda self: -1,
Tensor._grad_fn.__get__: lambda self: -1,
Tensor.grad_fn.__get__: lambda self: -1,
Tensor.grad_dtype.__get__: lambda self: -1,
Tensor._version.__get__: lambda self: -1,
Tensor._autocast_to_reduced_precision: lambda self, cuda_enabled, cpu_enabled, cuda_dtype, cpu_dtype: -1,
Tensor._autocast_to_full_precision: lambda self, cuda_enabled, cpu_enabled: -1,