Package org.deeplearning4j.nn.gradient
Class DefaultGradient
- java.lang.Object
-
- org.deeplearning4j.nn.gradient.DefaultGradient
-
- All Implemented Interfaces:
Serializable,Gradient
public class DefaultGradient extends Object implements Gradient
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static charDEFAULT_FLATTENING_ORDER
-
Constructor Summary
Constructors Constructor Description DefaultGradient()DefaultGradient(INDArray flattenedGradient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear residual parameters (useful for returning a gradient and then clearing old objects)CharacterflatteningOrderForVariable(String variable)Return the gradient flattening order for the specified variable, or null if it is not explicitly setINDArraygetGradientFor(String variable)The gradient for the given variableINDArraygradient()The full gradient as one flat vectorINDArraygradient(List<String> order)The full gradient as one flat vectorMap<String,INDArray>gradientForVariable()Gradient look up tableINDArraysetGradientFor(String variable, INDArray newGradient)Update gradient for the given variableINDArraysetGradientFor(String variable, INDArray gradient, Character flatteningOrder)Update gradient for the given variable; also (optionally) specify the order in which the array should be flattened to a row vectorStringtoString()
-
-
-
Field Detail
-
DEFAULT_FLATTENING_ORDER
public static final char DEFAULT_FLATTENING_ORDER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultGradient
public DefaultGradient()
-
DefaultGradient
public DefaultGradient(INDArray flattenedGradient)
-
-
Method Detail
-
gradientForVariable
public Map<String,INDArray> gradientForVariable()
Description copied from interface:GradientGradient look up table- Specified by:
gradientForVariablein interfaceGradient- Returns:
- the gradient look up table
-
gradient
public INDArray gradient(List<String> order)
Description copied from interface:GradientThe full gradient as one flat vector
-
gradient
public INDArray gradient()
Description copied from interface:GradientThe full gradient as one flat vector
-
clear
public void clear()
Description copied from interface:GradientClear residual parameters (useful for returning a gradient and then clearing old objects)
-
getGradientFor
public INDArray getGradientFor(String variable)
Description copied from interface:GradientThe gradient for the given variable- Specified by:
getGradientForin interfaceGradient- Parameters:
variable- the variable to get the gradient for- Returns:
- the gradient for the given variable or null
-
setGradientFor
public INDArray setGradientFor(String variable, INDArray newGradient)
Description copied from interface:GradientUpdate gradient for the given variable- Specified by:
setGradientForin interfaceGradient- Parameters:
variable- the variable to get the gradient fornewGradient- the gradient values- Returns:
- the gradient for the given variable or null
-
setGradientFor
public INDArray setGradientFor(String variable, INDArray gradient, Character flatteningOrder)
Description copied from interface:GradientUpdate gradient for the given variable; also (optionally) specify the order in which the array should be flattened to a row vector- Specified by:
setGradientForin interfaceGradient- Parameters:
variable- the variable to get the gradient forgradient- the gradient valuesflatteningOrder- the order in which gradients should be flattened (null ok - default)- Returns:
- the gradient for the given variable or null
-
flatteningOrderForVariable
public Character flatteningOrderForVariable(String variable)
Description copied from interface:GradientReturn the gradient flattening order for the specified variable, or null if it is not explicitly set- Specified by:
flatteningOrderForVariablein interfaceGradient- Parameters:
variable- Variable to return the gradient flattening order for- Returns:
- Order in which the specified variable's gradient should be flattened
-
-