Package org.nd4j.linalg.learning.config
Interface IUpdater
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IUpdaterclone()Clone the updaterbooleanequals(Object updater)doublegetLearningRate(int iteration, int epoch)Get the learning rate - if any - for the updater, at the specified iteration and epoch.booleanhasLearningRate()GradientUpdaterinstantiate(Map<String,INDArray> updaterState, boolean initializeStateArrays)GradientUpdaterinstantiate(INDArray viewArray, boolean initializeViewArray)Create a new gradient updatervoidsetLrAndSchedule(double lr, ISchedule lrSchedule)Set the learning rate and schedule.longstateSize(long numParams)Determine the updater state size for the given number of parameters.
-
-
-
Method Detail
-
stateSize
long stateSize(long numParams)
Determine the updater state size for the given number of parameters. Usually a integer multiple (0,1 or 2) times the number of parameters in a layer.- Parameters:
numParams- Number of parameters- Returns:
- Updater state size for the given number of parameters
-
instantiate
GradientUpdater instantiate(INDArray viewArray, boolean initializeViewArray)
Create a new gradient updater- Parameters:
viewArray- The updater state size view awayinitializeViewArray- If true: initialise the updater state- Returns:
-
instantiate
GradientUpdater instantiate(Map<String,INDArray> updaterState, boolean initializeStateArrays)
-
clone
IUpdater clone()
Clone the updater
-
getLearningRate
double getLearningRate(int iteration, int epoch)Get the learning rate - if any - for the updater, at the specified iteration and epoch. Note that if no learning rate is applicable (AdaDelta, NoOp updaters etc) then Double.NaN should be return- Parameters:
iteration- Iteration at which to get the learning rateepoch- Epoch at which to get the learning rate- Returns:
- Learning rate, or Double.NaN if no learning rate is applicable for this updater
-
hasLearningRate
boolean hasLearningRate()
- Returns:
- True if the updater has a learning rate hyperparameter, false otherwise
-
setLrAndSchedule
void setLrAndSchedule(double lr, ISchedule lrSchedule)Set the learning rate and schedule. Note: may throw an exception ifhasLearningRate()returns false.- Parameters:
lr- Learning rate to set (typically not used if LR schedule is non-null)lrSchedule- Learning rate schedule to set (may be null)
-
-