Optimizer

public abstract class Optimizer
Known Direct Subclasses

Base class for gradient optimizers.

Nested Classes

class Optimizer.GradAndVar <T extends TType > A class that holds a paired gradient and variable.
class Optimizer.Options Optional attributes for Optimizer

Constants

String VARIABLE_V2

Public Methods

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

Inherited Methods

Constants

public static final String VARIABLE_V2

Constant Value: "VariableV2"

Public Methods

public Op applyGradients (List< GradAndVar <? extends TType >> gradsAndVars, String name)

Applies gradients to variables

Parameters
gradsAndVars the list of (gradient, variable) pairs.
name the name of the apply gradients operation
Returns
  • an Op that applies the gradients to the variables.

public List< GradAndVar <?>> computeGradients ( Operand <?> loss)

Computes the gradients based on a loss operand.

Parameters
loss the loss operation
Returns
  • the computed gradients

public static String createName ( Output <? extends TType > variable, String slotName)

Creates a name by combining a variable name and a slot name

Parameters
variable the variable
slotName the name of the slot
Returns
  • the combined name

public abstract String getOptimizerName ()

Get the Name of the optimizer.

Returns
  • The optimizer name.

public Optional< Variable <T>> getSlot ( Output <T> var, String slotName)

Gets the slot associated with the specified variable and slot name.

Parameters
var The variable to lookup.
slotName The slot name.
Returns

public final Ops getTF ()

Gets the Optimizer's Ops instance

Returns
  • the Optimizer's Ops instance

public Op minimize ( Operand <?> loss)

Minimizes the loss by updating the variables

Parameters
loss the loss operation that returns the value to minimize
Returns
  • returns op that minimizes the loss by updating the listed variables

public Op minimize ( Operand <?> loss, String name)

Minimizes the loss by updating the variables

Parameters
loss the loss operation that returns the value to minimize
name the name for the minimize operation
Returns
  • op that minimizes the loss by updating the listed variables