Optimizer that implements the RMSProp algorithm. See the [paper](http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf).
| 52 | |
| 53 | @tf_export(v1=["train.RMSPropOptimizer"]) |
| 54 | class RMSPropOptimizer(optimizer.Optimizer): |
| 55 | """Optimizer that implements the RMSProp algorithm. |
| 56 | |
| 57 | See the |
| 58 | [paper](http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf). |
| 59 | """ |
| 60 | |
| 61 | def __init__(self, |
| 62 | learning_rate, |
| 63 | decay=0.9, |
| 64 | momentum=0.0, |
| 65 | epsilon=1e-10, |
| 66 | use_locking=False, |
| 67 | centered=False, |
| 68 | name="RMSProp"): |
| 69 | """Construct a new RMSProp optimizer. |
| 70 | |
| 71 | Note that in the dense implementation of this algorithm, variables and their |
| 72 | corresponding accumulators (momentum, gradient moving average, square |
| 73 | gradient moving average) will be updated even if the gradient is zero |
| 74 | (i.e. accumulators will decay, momentum will be applied). The sparse |
| 75 | implementation (used when the gradient is an `IndexedSlices` object, |
| 76 | typically because of `tf.gather` or an embedding lookup in the forward pass) |
| 77 | will not update variable slices or their accumulators unless those slices |
| 78 | were used in the forward pass (nor is there an "eventual" correction to |
| 79 | account for these omitted updates). This leads to more efficient updates for |
| 80 | large embedding lookup tables (where most of the slices are not accessed in |
| 81 | a particular graph execution), but differs from the published algorithm. |
| 82 | |
| 83 | Args: |
| 84 | learning_rate: A Tensor or a floating point value. The learning rate. |
| 85 | decay: Discounting factor for the history/coming gradient |
| 86 | momentum: A scalar tensor. |
| 87 | epsilon: Small value to avoid zero denominator. |
| 88 | use_locking: If True use locks for update operation. |
| 89 | centered: If True, gradients are normalized by the estimated variance of |
| 90 | the gradient; if False, by the uncentered second moment. Setting this to |
| 91 | True may help with training, but is slightly more expensive in terms of |
| 92 | computation and memory. Defaults to False. |
| 93 | name: Optional name prefix for the operations created when applying |
| 94 | gradients. Defaults to "RMSProp". |
| 95 | |
| 96 | @compatibility(eager) |
| 97 | When eager execution is enabled, `learning_rate`, `decay`, `momentum`, and |
| 98 | `epsilon` can each be a callable that takes no arguments and returns the |
| 99 | actual value to use. This can be useful for changing these values across |
| 100 | different invocations of optimizer functions. |
| 101 | @end_compatibility |
| 102 | """ |
| 103 | super(RMSPropOptimizer, self).__init__(use_locking, name) |
| 104 | self._learning_rate = learning_rate |
| 105 | self._decay = decay |
| 106 | self._momentum = momentum |
| 107 | self._epsilon = epsilon |
| 108 | self._centered = centered |
| 109 | |
| 110 | # Tensors for learning rate and momentum. Created in _prepare. |
| 111 | self._learning_rate_tensor = None |
no outgoing calls