Fix the autograd codegen for repeat function (#40766)
Summary:
Fix https://github.com/pytorch/pytorch/issues/40701
A new special case is added to let `dim()` save an int instead of self.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40766
Differential Revision: D22308354
Pulled By: albanD
fbshipit-source-id: 69008230d7398b9e06b8e074a549ae921c2bf603