Momentum

public class Momentum

Stochastic gradient descent plus momentum, either nesterov or traditional.

See the paper for details of nesterov momentum.

Constants

Inherited Constants

org.tensorflow.framework.optimizers.Optimizer
String VARIABLE_V2

Public Constructors

Momentum(Graph graph)
Creates a Momentum Optimizer
Momentum(Graph graph, float learningRate)
Creates a Momentum Optimizer
Momentum(Graph graph, float learningRate, float momentum)
Creates a Momentum Optimizer
Momentum(Graph graph, float learningRate, float momentum, boolean useNesterov)
Creates a Momentum Optimizer
Momentum(Graph graph, String name, float learningRate, float momentum, boolean useNesterov)
Creates a Momentum Optimizer

Public Methods

String
getOptimizerName()
Get the Name of the optimizer.
String

Inherited Methods

org.tensorflow.framework.optimizers.Optimizer
Op
applyGradients(List<GradAndVar<? extends TType>> gradsAndVars, String name)
Applies gradients to variables
<T extends TType> List<GradAndVar<?>>
computeGradients(Operand<?> loss)
Computes the gradients based on a loss operand.
static String
createName(Output<? extends TType> variable, String slotName)
Creates a name by combining a variable name and a slot name
abstract String
getOptimizerName()
Get the Name of the optimizer.
<T extends TType> Optional<Variable<T>>
getSlot(Output<T> var, String slotName)
Gets the slot associated with the specified variable and slot name.
final Ops
getTF()
Gets the Optimizer's Ops instance
Op
minimize(Operand<?> loss)
Minimizes the loss by updating the variables
Op
minimize(Operand<?> loss, String name)
Minimizes the loss by updating the variables
boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Constants

public static final float LEARNING_RATE_DEFAULT

Constant Value: 0.01

public static final String MOMENTUM

Constant Value: "momentum"

public static final float MOMENTUM_DEFAULT

Constant Value: 0.0

public static final boolean NESTEROV_DEFAULT

Constant Value: false

Public Constructors

public Momentum (Graph graph)

Creates a Momentum Optimizer

Parameters
graph the TensorFlow graph

public Momentum (Graph graph, float learningRate)

Creates a Momentum Optimizer

Parameters
graph the TensorFlow graph
learningRate the learning rate

public Momentum (Graph graph, float learningRate, float momentum)

Creates a Momentum Optimizer

Parameters
graph the TensorFlow graph
learningRate the learning rate
momentum hyperparameter that accelerates gradient descent in the relevant direction and dampens oscillations, Must be greater than or equal to zero. Default is 0.

public Momentum (Graph graph, float learningRate, float momentum, boolean useNesterov)

Creates a Momentum Optimizer

Parameters
graph the TensorFlow graph
learningRate the learning rate
momentum hyperparameter that accelerates gradient descent in the relevant direction and dampens oscillations, Must be greater than or equal to zero. Default is 0.
useNesterov Whether to apply Nesterov momentum. Defaults to false.

public Momentum (Graph graph, String name, float learningRate, float momentum, boolean useNesterov)

Creates a Momentum Optimizer

Parameters
graph the TensorFlow graph
name the name for this Optimizer
learningRate the learning rate
momentum hyperparameter that accelerates gradient descent in the relevant direction and dampens oscillations, Must be greater than or equal to zero. Default is 0.
useNesterov Whether to apply Nesterov momentum. Defaults to false.

Public Methods

public String getOptimizerName ()

Get the Name of the optimizer.

Returns
  • The optimizer name.

public String toString ()