ApplyMomentum
tensorflow C++ API
tensorflow::ops::ApplyMomentum
Update '*var' according to the momentum scheme.
Summary
accum_new = accum + grad * grad linear += grad + (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 accum = accum_new
Arguments:
- scope: A Scope object
- var: Should be from a Variable().
- accum: Should be from a Variable().
- linear: Should be from a Variable().
- grad: The gradient.
- lr: Scaling factor. Must be a scalar.
- l1: L1 regulariation. Must be a scalar.
- l2: L2 regulariation. Must be a scalar.
- lr_power: Scaling factor. Must be a scalar.
Optional attributes (seeAttrs
):
- use_locking: If
True
, updating of the var and accum tensors will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.
Returns:
Output
: Same as "var".
ApplyMomentum block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_training.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input var: connect Input node.
- Input accum: connect Input node.
- Input linear: connect Input node.
- Input grad: connect Input node.
- Input lr: connect Input node.
- Input l1: connect Input node.
- Input l2: connect Input node.
- Input lr_power: connect Input node.
- ApplyFtrl ::Attrs attrs : Input attrs in value. ex) use_locking_ = false;
Return:
- Output output : Output object of ApplyMomentum class object.
Result:
- std::vector(Tensor) result_output : Returned object of executed result by calling session.