public class UpdaterBlock extends Object
BaseMultiLayerUpdater
, this class implements updating (i.e., Adam, RMSProp, Momentum,
etc) across multiple contiguous layers/parameters, as described in the BaseMultiLayerUpdater
javadoc.Modifier and Type | Class and Description |
---|---|
static class |
UpdaterBlock.ParamState |
Constructor and Description |
---|
UpdaterBlock(int paramOffsetStart,
int paramOffsetEnd,
int updaterViewOffsetStart,
int updaterViewOffsetEnd,
List<UpdaterBlock.ParamState> layersAndVariablesInBlock) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyRegularization(Regularization.ApplyStep step,
Trainable layer,
String paramName,
INDArray gradientView,
INDArray paramsView,
int iter,
int epoch,
double lr)
Apply L1 and L2 regularization, if necessary.
|
protected void |
applyRegularizationAllVariables(Regularization.ApplyStep applyStep,
int iteration,
int epoch,
boolean externalGradient,
INDArray fullNetworkGradientView,
INDArray fullNetworkParamsArray) |
GradientUpdater |
getGradientUpdater() |
void |
init() |
boolean |
isPretrainUpdaterBlock() |
boolean |
skipDueToPretrainConfig(boolean isLayerUpdater) |
void |
update(int iteration,
int epoch)
Update the gradient for this block
|
void |
updateExternalGradient(int iteration,
int epoch,
INDArray fullNetworkGradientView,
INDArray fullNetworkParamsArray) |
public UpdaterBlock(int paramOffsetStart, int paramOffsetEnd, int updaterViewOffsetStart, int updaterViewOffsetEnd, List<UpdaterBlock.ParamState> layersAndVariablesInBlock)
paramOffsetStart
- Start offset of the parameters in this block (relative to overall net params
view array)paramOffsetEnd
- End offset of the parameters in this block (relative to overall net params
view array)updaterViewOffsetStart
- Start offset of the updater state array in this block (relative to overall net
updater state view array)updaterViewOffsetEnd
- End offset of the updater state array in this block (relative to overall net
updater state view array)layersAndVariablesInBlock
- List of layers and variables in this updater block. By definition, all layers
and variables in this list must have an identical updater configuration.public void init()
public boolean isPretrainUpdaterBlock()
public boolean skipDueToPretrainConfig(boolean isLayerUpdater)
public GradientUpdater getGradientUpdater()
public void update(int iteration, int epoch)
iteration
- The current iteration (i.e., total number of parameter updates so far)public void updateExternalGradient(int iteration, int epoch, INDArray fullNetworkGradientView, INDArray fullNetworkParamsArray)
protected void applyRegularizationAllVariables(Regularization.ApplyStep applyStep, int iteration, int epoch, boolean externalGradient, INDArray fullNetworkGradientView, INDArray fullNetworkParamsArray)
protected void applyRegularization(Regularization.ApplyStep step, Trainable layer, String paramName, INDArray gradientView, INDArray paramsView, int iter, int epoch, double lr)
layer
- The layer to apply L1/L2 toparamName
- Parameter name in the given layergradientView
- Gradient view array for the layer + paramparamsView
- Parameter view array for the layer + paramCopyright © 2019. All rights reserved.