Improved sparse CSR tensor sampling method (#60283)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/59379
The improved sparse CSR tensor sampling method is described in https://pearu.github.io/csr_sampling.html that features:
- for specified `nnz`, one gets a CSR sample with the same `nnz`
- variability of the number of specified columns per row is maximized
- `crow_indices` content is randomized
- a given row specific `col_indices` content is sorted and filled with unique values (see also https://github.com/pytorch/pytorch/issues/60277)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60283
Reviewed By: bhosmer
Differential Revision: D29492605
Pulled By: cpuhrsch
fbshipit-source-id: 8d875b7c2b0573a9ab37047c6d8fe8b540295ce1