Simplify replicate_model_fn.GatheringOptimizer inspired by the past comments.
authorIgor Saprykin <isaprykin@google.com>
Tue, 9 Jan 2018 23:12:55 +0000 (15:12 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Tue, 9 Jan 2018 23:20:03 +0000 (15:20 -0800)
commit8f07a0677bf26506a49d7a714a63f5fd115e6945
tree97f2bb3f5e73789b5a0f6b3142f10de8920d2f96
parent454885e6546660d8f7eeb3ce137580b0505e9a77
Simplify replicate_model_fn.GatheringOptimizer inspired by the past comments.

- I worked around the need to rely on Optimizer.__class__ for keeping track of the gradients. Now we are relying on the order of collecting them.  I also added a basic verification that all towers have indeed called the same number of optimizers.
- I now allow the user to increment global step however many times they wish.

The changes above allowed me to support using the same optimizer class multiple times in a tower.

I also renamed GatheringOptimizer to TowerOptimizer, which is a breaking change.  #lifeincontrib

PiperOrigin-RevId: 181381569
tensorflow/contrib/estimator/__init__.py
tensorflow/contrib/estimator/python/estimator/replicate_model_fn.py
tensorflow/contrib/estimator/python/estimator/replicate_model_fn_test.py