Fix copied optimizer (#19308)
authorbarrh <elhararb@gmail.com>
Fri, 19 Apr 2019 17:12:46 +0000 (10:12 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 19 Apr 2019 17:27:01 +0000 (10:27 -0700)
commit557b1b362fba144676edf42a5fa730dd2c22448b
tree638180d1487adfdeaf21ddd75e40f272b3169b65
parent30292d994fabf24146fe0dbcfe9621d4f87325e2
Fix copied optimizer (#19308)

Summary:
Add the defaults field to the copied object.
Prior to this patch, optimizer.__getattr__ has excluded the defaults
attribute of optimizer source object, required by some LR schedulers. (e.g. CyclicLR with momentum)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19308

Differential Revision: D15012801

Pulled By: soumith

fbshipit-source-id: 95801b269f6f9d78d531d4fed95c973b280cc96f
test/test_optim.py
torch/optim/optimizer.py