Class GradientDescent
java.lang.Object
org.tensorflow.framework.optimizers.Optimizer
org.tensorflow.framework.optimizers.GradientDescent
Basic Stochastic gradient descent optimizer. GradientDescent updates the current weight using the
current gradient ?L/?w multiplied by the learning rate.
-
Nested Class Summary
Nested classes/interfaces inherited from class Optimizer
Optimizer.GradAndVar<T>, Optimizer.OptionsModifier and TypeClassDescriptionstatic classOptimizer.GradAndVar<T extends TType>A class that holds a paired gradient and variable.static classOptional attributes forOptimizer -
Field Summary
FieldsFields inherited from class Optimizer
globals, graph, tf, VARIABLE_V2 -
Constructor Summary
ConstructorsConstructorDescriptionGradientDescent(Graph graph) Creates a GradientDescent OptimizerGradientDescent(Graph graph, float learningRate) Creates a GradientDescent OptimizerGradientDescent(Graph graph, String name, float learningRate) Creates a GradientDescent Optimizer -
Method Summary
Modifier and TypeMethodDescriptionapplyDense(Ops deps, Output<T> gradient, Output<T> variable) Generates the gradient update operations for the specific variable and gradient.Get the Name of the optimizer.toString()Methods inherited from class Optimizer
applyGradients, computeGradients, createName, createSlot, createSlots, finish, getSlot, getTF, minimize, minimize, prepareModifier and TypeMethodDescriptionapplyGradients(List<Optimizer.GradAndVar<? extends TType>> gradsAndVars, String name) Applies gradients to variables<T extends TType>
List<Optimizer.GradAndVar<?>> computeGradients(Operand<?> loss) Computes the gradients based on a loss operand.static StringcreateName(Output<? extends TType> variable, String slotName) Creates a name by combining a variable name and a slot nameprotected <T extends TType>
voidcreateSlot(Output<T> variable, String slotName, Operand<T> initializer) Creates a slot in the graph for the specified variable with the specified name.protected voidcreateSlots(List<Output<? extends TType>> variables) Performs a No-op slot creation method.protected OpGathers up the update operations into a single op that can be used as a run target.Gets the slot associated with the specified variable and slot name.final OpsgetTF()Gets the Optimizer's Ops instanceMinimizes the loss by updating the variablesMinimizes the loss by updating the variablesReturns a No-op prepare.
-
Field Details
-
LEARNING_RATE_DEFAULT
public static final float LEARNING_RATE_DEFAULT- See Also:
-
-
Constructor Details
-
GradientDescent
Creates a GradientDescent Optimizer- Parameters:
graph- the TensorFlow graph
-
GradientDescent
Creates a GradientDescent Optimizer- Parameters:
graph- the TensorFlow graphlearningRate- the learning rate, defaults to 0.01
-
GradientDescent
-
-
Method Details
-
applyDense
Generates the gradient update operations for the specific variable and gradient.- Specified by:
applyDensein classOptimizer- Type Parameters:
T- The type of the variable.- Parameters:
gradient- The gradient to use.variable- The variable to update.- Returns:
- An operand which applies the desired optimizer update to the variable.
-
toString
-
getOptimizerName
Get the Name of the optimizer.- Specified by:
getOptimizerNamein classOptimizer- Returns:
- The optimizer name.
-