public class FrozenLayer extends BaseWrapperLayer
Layer.TrainingMode, Layer.Typeunderlying| Constructor and Description |
|---|
FrozenLayer(Layer insideLayer) |
| Modifier and Type | Method and Description |
|---|---|
INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
INDArray |
activate(INDArray input,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the specified input
|
void |
applyConstraints(int iteration,
int epoch)
Apply any constraints to the model
|
Pair<Gradient,INDArray> |
backpropGradient(INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
double |
calcRegularizationScore(boolean backpropParamsOnly)
Calculate the regularization component of the score, for the parameters in this layer
For example, the L1, L2 and/or weight decay components of the loss function |
void |
computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the score
|
void |
fit()
All models have a fit method
|
void |
fit(INDArray data,
LayerWorkspaceMgr workspaceMgr)
Fit the model to the given data
|
TrainingConfig |
getConfig() |
Layer |
getInsideLayer() |
Gradient |
gradient()
Get the gradient.
|
Pair<Gradient,Double> |
gradientAndScore()
Get the gradient and score
|
void |
init()
Init the model
|
protected String |
layerId() |
void |
logTestMode(boolean training) |
void |
logTestMode(Layer.TrainingMode training) |
void |
setBackpropGradientsViewArray(INDArray gradients)
Set the gradients array as a view of the full (backprop) network parameters
NOTE: this is intended to be used internally in MultiLayerNetwork and ComputationGraph, not by users.
|
void |
setCacheMode(CacheMode mode)
This method sets given CacheMode for current layer
|
void |
update(Gradient gradient)
Update layer weights and biases with gradient change
|
void |
update(INDArray gradient,
String paramType)
Perform one update applying the gradient
|
addListeners, allowInputModification, batchSize, clear, clearNoiseWeightParams, close, conf, feedForwardMaskArray, getEpochCount, getGradientsViewArray, getHelper, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, getOptimizer, getParam, input, isPretrainLayer, numParams, numParams, params, paramTable, paramTable, score, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArray, setParam, setParams, setParamsViewArray, setParamTable, type, updaterDivideByMinibatchpublic FrozenLayer(Layer insideLayer)
public void setCacheMode(CacheMode mode)
LayersetCacheMode in interface LayersetCacheMode in class BaseWrapperLayerprotected String layerId()
public double calcRegularizationScore(boolean backpropParamsOnly)
LayercalcRegularizationScore in interface LayercalcRegularizationScore in class BaseWrapperLayerbackpropParamsOnly - If true: calculate regularization score based on backprop params only. If false: calculate
based on all params (including pretrain params, if any)public Pair<Gradient,INDArray> backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
LayerbackpropGradient in interface LayerbackpropGradient in class BaseWrapperLayerepsilon - w^(L+1)*delta^(L+1). Or, equiv: dC/da, i.e., (dC/dz)*(dz/da) = dC/da, where C
is cost function a=sigma(z) is activation.workspaceMgr - Workspace managerArrayType.ACTIVATION_GRAD workspace via the workspace managerpublic INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layeractivate in interface Layeractivate in class BaseWrapperLayertraining - training or test modeworkspaceMgr - Workspace managerArrayType.ACTIVATIONS workspace via the workspace managerpublic INDArray activate(INDArray input, boolean training, LayerWorkspaceMgr workspaceMgr)
Layeractivate in interface Layeractivate in class BaseWrapperLayerinput - the input to usetraining - train or test modeworkspaceMgr - Workspace manager.ArrayType.ACTIVATIONS workspace via the workspace managerpublic void fit()
Modelfit in interface Modelfit in class BaseWrapperLayerpublic void update(Gradient gradient)
Modelupdate in interface Modelupdate in class BaseWrapperLayerpublic void update(INDArray gradient, String paramType)
Modelupdate in interface Modelupdate in class BaseWrapperLayergradient - the gradient to applypublic void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
ModelcomputeGradientAndScore in interface ModelcomputeGradientAndScore in class BaseWrapperLayerpublic void setBackpropGradientsViewArray(INDArray gradients)
ModelsetBackpropGradientsViewArray in interface ModelsetBackpropGradientsViewArray in class BaseWrapperLayergradients - a 1 x nParams row vector that is a view of the larger (MLN/CG) gradients arraypublic void fit(INDArray data, LayerWorkspaceMgr workspaceMgr)
Modelfit in interface Modelfit in class BaseWrapperLayerdata - the data to fit the model topublic Gradient gradient()
ModelModel.computeGradientAndScore(LayerWorkspaceMgr) } .gradient in interface Modelgradient in class BaseWrapperLayerpublic Pair<Gradient,Double> gradientAndScore()
ModelgradientAndScore in interface ModelgradientAndScore in class BaseWrapperLayerpublic void applyConstraints(int iteration,
int epoch)
ModelapplyConstraints in interface ModelapplyConstraints in class BaseWrapperLayerpublic void init()
init in interface Modelinit in class BaseWrapperLayerpublic void logTestMode(boolean training)
public void logTestMode(Layer.TrainingMode training)
public Layer getInsideLayer()
public TrainingConfig getConfig()
getConfig in interface TrainablegetConfig in class BaseWrapperLayerCopyright © 2020. All rights reserved.