You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[foreach][mta] Inplace maximum and minimum (pytorch#82523)
### Description
<!-- What did you change and why was it needed? -->
Implement `torch._foreach_maximum_` and `torch._foreach_minimum_` mainly for `_multi_tensor_adam` and `_multi_tensor_adamw` with `amsgrad=True` to correctly update their `max_exp_avg_sqs`.
### Issue
<!-- Link to Issue ticket or RFP -->
- pytorch#78807
- pytorch#81894
- pytorch#81348
- pytorch#81705
- pytorch#58833
- pytorch#68041
### Testing
<!-- How did you test your change? -->
Updated `test_foreach.py::TestForeach::_minmax_test` to compare the outputs of `_foreach_maximum_` (and `_foreach_minimum_`) against those of `[torch.maximum(a, b) for a, b in zip(tensors1, tensors2)]`
cc @ngimel@albanD@mikaylagawarecki
Pull Request resolved: pytorch#82523
Approved by: https://github.com/albanD
0 commit comments