Add missing type annotation for Tensor.ndim (#42909)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/42908
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42909
Reviewed By: zhangguanheng66
Differential Revision: D23090364
Pulled By: malfet
fbshipit-source-id: 44457fddc86f6abde635aa671e7611b405780ab9