Add type hint for retains_grad (#103528)
Fixes #103485
Type checkers don't know about the existence of `retains_grad` otherwise:
```python
torch.randn(10, 10).retains_grad # Cannot access member "retains_grad" for type "Tensor"
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/103528
Approved by: https://github.com/albanD, https://github.com/Skylion007, https://github.com/janeyx99