Add a check for n<0 and a test for it (#95144)
Fixes [94740
](https://github.com/pytorch/pytorch/issues/94740) Adds a check in `aten/src/ATen/native/ReduceOps.cpp` and a test case in test/test_torch.py
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95144
Approved by: https://github.com/lezcano