W3cubDocs

/TensorFlow C++

tensorflow::ops::ApplyMomentum

#include <training_ops.h>

Update '*var' according to the momentum scheme.

Summary

Set use_nesterov = True if you

want to use Nesterov momentum.

accum = accum * momentum + grad var -= lr * accum

Arguments:

  • scope: A Scope object
  • var: Should be from a Variable().
  • accum: Should be from a Variable().
  • lr: Scaling factor. Must be a scalar.
  • grad: The gradient.
  • momentum: Momentum. Must be a scalar.

Optional attributes (see Attrs):

  • 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.
  • use_nesterov: If True, the tensor passed to compute grad will be var - lr * momentum * accum, so in the end, the var you get is actually var - lr * momentum * accum.

Returns:

Constructors and Destructors
ApplyMomentum(const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input lr, ::tensorflow::Input grad, ::tensorflow::Input momentum)
ApplyMomentum(const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input lr, ::tensorflow::Input grad, ::tensorflow::Input momentum, const ApplyMomentum::Attrs & attrs)
Public attributes
out
Public functions
node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const
Public static functions
UseLocking(bool x)
UseNesterov(bool x)
Structs
tensorflow::ops::ApplyMomentum::Attrs

Optional attribute setters for ApplyMomentum.

Public attributes

out

::tensorflow::Output out

Public functions

ApplyMomentum

 ApplyMomentum(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input var,
  ::tensorflow::Input accum,
  ::tensorflow::Input lr,
  ::tensorflow::Input grad,
  ::tensorflow::Input momentum
)

ApplyMomentum

 ApplyMomentum(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input var,
  ::tensorflow::Input accum,
  ::tensorflow::Input lr,
  ::tensorflow::Input grad,
  ::tensorflow::Input momentum,
  const ApplyMomentum::Attrs & attrs
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

operator::tensorflow::Input() const 

operator::tensorflow::Output

operator::tensorflow::Output() const 

Public static functions

UseLocking

Attrs UseLocking(
  bool x
)

UseNesterov

Attrs UseNesterov(
  bool x
)

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/apply-momentum.html