ApplyAdam
tensorflow C++ API
Update ‘*var’ according to the Adam algorithm.
Summary
lr_t <- learning_rate * sqrt(1 - beta2^t) / (1 - beta1^t) m_t <- beta1 * m_{t-1} + (1 - beta1) * g_t v_t <- beta2 * v_{t-1} + (1 - beta2) * g_t * g_t variable <- variable - lr_t * m_t / (sqrt(v_t) + epsilon)
Arguments:
- scope: A Scope object
- var: Should be from a Variable().
- m: Should be from a Variable().
- v: Should be from a Variable().
- beta1_power: Must be a scalar.
- beta2_power: Must be a scalar.
- lr: Scaling factor. Must be a scalar.
- beta1: Momentum factor. Must be a scalar.
- beta2: Momentum factor. Must be a scalar.
- epsilon: Ridge term. Must be a scalar.
- grad: The gradient.
Optional attributes (seeAttrs
):
- use_locking: If
True
, updating of the var, m, and v tensors will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention. - use_nesterov: If
True
, uses the nesterov update.
Returns:
Output
: Same as “var”.
ApplyAdam 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 m: connect Input node.
- Input v: connect Input node.
- Input beta1_power: connect Input node.
- Input beta2_power: connect Input node.
- Input lr: connect Input node.
- Input beta1: connect Input node.
- Input beta2: connect Input node.
- Input epsilon: connect Input node.
- Input grad: connect Input node.
- ApplyAdam ::Attrs attrs : Input attrs in value. ex) use_locking_ = false;use_nesterov__=false;
Return:
- Output output : Output object of ApplyAdam class object.
Result:
- std::vector(Tensor) result_output : Returned object of executed result by calling session.