Refactor gather_ranges_to_dense from Python to C++ (#46021)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46021
Refactor gather_ranges_to_dense from Python to C++
https://www.internalfb.com/intern/tasks/?t=71935517
Test Plan:
General build/test:
```
buck build -c python.helpers=true fbcode/caffe2
buck test -c python.helpers=true fbcode/caffe2
```
Specific Test:
```buck test mode/dev-nosan //caffe2/torch/fb/sparsenn:test -- 'test_gather_ranges_to_dense \(caffe2\.torch\.fb\.sparsenn\.tests\.sparsenn_operators_test\.SparseNNOperatorsTest\)'
```
Reviewed By: houseroad
Differential Revision: D23858186
fbshipit-source-id: 8bce7c279275c8ff7316901b455e1d1dd7e36b13