Add at::Tensor::retain_grad API (#33349)
Summary:
This PR adds `at::Tensor::retain_grad`, and its implementation mirrors the Python `torch.Tensor.retain_grad` API:
https://github.com/pytorch/pytorch/blob/c6271c63f21cd886ded73787e53844588cff5e74/torch/tensor.py#L292-L315
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33349
Differential Revision: D19944524
Pulled By: yf225
fbshipit-source-id: e61d5d761996b6d1b860c04c4b4650c1a49a6a8c