lightning/pytorch_lightning/accelerators
Justus Schock 0ec4107697
Optimizer closure (#4190)
* closure for all optimizers

* rename hook and take care of alternating backwards

* add comment

* training_loop_fix

* closure whenever possible

* training_loop

* simple tests that count backward calls

* fix test to work with closure

* remove debugging statement

* better place

* check grads after backward

* start fixing manual optimization

* skip step when result returned by closure was None

* fix gradient clipping test to work with closure

* attribute dict result only for automatic optimization

* adjust backward calls in accelerator

* adjust where to call gradient clipping

* adjust backward calls in tests

* Apply suggestions from code review

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>

* pass kwargs to xla optimizer

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
2020-10-21 19:34:29 +01:00
..
__init__.py notices (#4118) 2020-10-13 07:18:07 -04:00
accelerator.py Optimizer closure (#4190) 2020-10-21 19:34:29 +01:00
accelerator_connector.py notices (#4118) 2020-10-13 07:18:07 -04:00
cpu_accelerator.py ref: accelerator names (#4066) 2020-10-11 01:05:14 -04:00
ddp2_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_cpu_slurm_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_cpu_spawn_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_cpu_torchelastic_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_slurm_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_spawn_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
ddp_torchelastic_accelerator.py docs: Add empty lines in docstring [ci skip] (#4232) 2020-10-21 09:00:39 -04:00
dp_accelerator.py ref: accelerator names (#4066) 2020-10-11 01:05:14 -04:00
gpu_accelerator.py ref: accelerator names (#4066) 2020-10-11 01:05:14 -04:00
horovod_accelerator.py CI: add flake8 (#4239) 2020-10-19 21:20:17 +01:00
tpu_accelerator.py Use `Optional` for arguments set to `None` by default (#4164) 2020-10-15 23:02:50 +02:00