cherry-picking autodiff support for gather/index_select (#93333)
added gather & index_select in autodiff;
test coverage should be handled by opinfo;
Pull Request resolved: https://github.com/pytorch/pytorch/pull/93333
Approved by: https://github.com/ngimel