Repository: pytorch
Issue: Reductions tracking issue
Labels: triaged,module: numpy,module: reductions,tracker

This issue is for tracking and organizing tasks related to reduction operators. For 1.10 we are focusing on aligning API with the [Python Array API Standard](https://data-apis.org/array-api/latest/API_specification/index.html) and test improvements.

_Note that some of the tasks below need further discussion before we decide to commit to them._

## API
Reduction operators should implement the Python Array API Standard which includes supporting all data types (unless noted in the documentation otherwise) and performing type promotion. They should be compatible with NumPy where possible (giving higher priority to the Python Array API Standard). Where applicable, they should support reducing over multiple dimensions.

**Python Array API Standard**
- [x] https://github.com/pytorch/pytorch/issues/44409
- [ ] https://github.com/pytorch/pytorch/issues/61486
- [ ] https://github.com/pytorch/pytorch/issues/61490
- [ ] https://github.com/pytorch/pytorch/issues/61582
- [x] https://github.com/pytorch/pytorch/issues/61492
- [ ] https://github.com/pytorch/pytorch/issues/50342
- [ ] https://github.com/pytorch/pytorch/issues/35529

**NumPy compatibility**
- [ ] https://github.com/pytorch/pytorch/issues/50010
- [ ] https://github.com/pytorch/pytorch/issues/29137
- [ ] https://github.com/pytorch/pytorch/issues/19149

**Scalar and empty tensors**
- [ ] https://github.com/pytorch/pytorch/issues/46999
- [x] https://github.com/pytorch/pytorch/issues/28380

**Variants**
- [ ] https://github.com/pytorch/pytorch/issues/24041
- [ ] https://github.com/pytorch/pytorch/issues/32570

**Type Promotion**
- [ ] https://github.com/pytorch/pytorch/issues/45833
- [x] https://github.com/pytorch/pytorch/issues/56132

## Testing
Reduction operators have additional structure than other operators such as dim and keepdim parameters which can be exploited to automate testing of many features. To do so, we can create a ReductionInfo subclass of OpInfo and update `test_reductions.py` to follow the OpInfo pattern. Some example of tests that can be automated are ensuring reduction operators support reducing over multiple dimensions, reducing over nonzero dimensions of empty tensors, and even testing for correctness by providing a reference implementation such as a NumPy equivalent operator.

- [x] https://github.com/pytorch/pytorch/issues/49746
- [x] https://github.com/pytorch/pytorch/issues/59550
- [x] https://github.com/pytorch/pytorch/issues/59415
- [ ] https://github.com/pytorch/pytorch/issues/53704

## Bugs

- [ ] https://github.com/pytorch/pytorch/issues/50382
- [ ] https://github.com/pytorch/pytorch/issues/46225
- [ ] https://github.com/pytorch/pytorch/issues/28993
- [ ] https://github.com/pytorch/pytorch/issues/23159
- [ ] https://github.com/pytorch/pytorch/issues/61523
- [x] https://github.com/pytorch/pytorch/issues/61656
- [x] https://github.com/pytorch/pytorch/issues/48573
- [x] https://github.com/pytorch/pytorch/issues/64008

## Performance

- [ ] https://github.com/pytorch/pytorch/issues/59545
- [x] https://github.com/pytorch/pytorch/issues/62164
- [ ] https://github.com/pytorch/pytorch/issues/51509
- [ ] https://github.com/pytorch/pytorch/issues/51450
- [ ] https://github.com/pytorch/pytorch/issues/40570
- [ ] https://github.com/pytorch/pytorch/issues/31837
- [x] https://github.com/pytorch/pytorch/issues/16617
- [ ] https://github.com/pytorch/pytorch/issues/57610
- [ ] https://github.com/pytorch/pytorch/issues/55366
- [ ] https://github.com/pytorch/pytorch/issues/63870
- [x] https://github.com/pytorch/pytorch/issues/63869

## Feature Requests

- [ ] https://github.com/pytorch/pytorch/issues/61474
- [ ] https://github.com/pytorch/pytorch/issues/35641
- [ ] https://github.com/pytorch/pytorch/issues/32998
- [ ] https://github.com/pytorch/pytorch/issues/32097
- [ ] https://github.com/pytorch/pytorch/issues/18904

**Allow specifying a range for dimensions to reduce over**
- [ ] https://github.com/pytorch/pytorch/issues/54766
- [ ] https://github.com/pytorch/pytorch/issues/32288

## Miscellaneous 

- [ ] https://github.com/pytorch/pytorch/issues/56764
- [ ] https://github.com/pytorch/pytorch/issues/41793
- [ ] https://github.com/pytorch/pytorch/issues/29758
- [ ] https://github.com/pytorch/pytorch/issues/27312
- [x] https://github.com/pytorch/pytorch/issues/25775

cc @mruberry @rgommers @heitorschueroff @gchanan