mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Fixes https://github.com/pytorch/pytorch/issues/36831. Instead of using `id()`, an arbitrary yet consistent order-based index is used instead. This results in a deterministic output between runs. I am not the biggest fan of using `nonlocal` (it appears to be used sparingly in the codebase) to get `start_index` between calls to `pack_group()`, but the alternatives had larger issues: - Using the last value added to `param_mappings` would be ideal, but that only works if `dict` iteration order is consistent, and PyTorch currently supports Python <3.7. - Using the maximum value added to `param_mappings` wouldn't have that issue but would not be constant time. For testing, I confirmed that `test_optim.py` works before and after these changes. Randomizing the indices in `param_mappings` causes the tests to fail, which is further evidence these changes work. I'm not 100% if these tests are sufficient, but they're a start. Pull Request resolved: https://github.com/pytorch/pytorch/pull/37347 Differential Revision: D21353820 Pulled By: vincentqb fbshipit-source-id: e549f1f154833a461b1f4df6d07ad509aab34ea1 |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| __init__.pyi | ||
| adadelta.py | ||
| adadelta.pyi | ||
| adagrad.py | ||
| adagrad.pyi | ||
| adam.py | ||
| adam.pyi | ||
| adamax.py | ||
| adamax.pyi | ||
| adamw.py | ||
| adamw.pyi | ||
| asgd.py | ||
| asgd.pyi | ||
| lbfgs.py | ||
| lbfgs.pyi | ||
| lr_scheduler.py | ||
| lr_scheduler.pyi | ||
| optimizer.py | ||
| optimizer.pyi | ||
| rmsprop.py | ||
| rmsprop.pyi | ||
| rprop.py | ||
| rprop.pyi | ||
| sgd.py | ||
| sgd.pyi | ||
| sparse_adam.py | ||
| sparse_adam.pyi | ||
| swa_utils.py | ||
| swa_utils.pyi | ||