public class FrozenLayer extends BaseWrapperLayer
Layer.TrainingMode, Layer.Typeunderlying| Constructor and Description |
|---|
FrozenLayer(Layer insideLayer) |
| Modifier and Type | Method and Description |
|---|---|
org.nd4j.linalg.api.ndarray.INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
org.nd4j.linalg.api.ndarray.INDArray |
activate(org.nd4j.linalg.api.ndarray.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
|
org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> |
backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
double |
calcL1(boolean backpropOnlyParams)
Calculate the l1 regularization term
0.0 if regularization is not used. |
double |
calcL2(boolean backpropOnlyParams)
Calculate the l2 regularization term
0.0 if regularization is not used. |
Layer |
clone()
Clone the layer
|
void |
computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the score
|
void |
fit()
All models have a fit method
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray data,
LayerWorkspaceMgr workspaceMgr)
Fit the model to the given data
|
Layer |
getInsideLayer() |
Gradient |
gradient()
Get the gradient.
|
org.nd4j.linalg.primitives.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(org.nd4j.linalg.api.ndarray.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(org.nd4j.linalg.api.ndarray.INDArray gradient,
String paramType)
Perform one update applying the gradient
|
accumulateScore, addListeners, batchSize, clear, clearNoiseWeightParams, conf, feedForwardMaskArray, getEpochCount, getGradientsViewArray, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, getOptimizer, getParam, initParams, input, isPretrainLayer, numParams, numParams, params, paramTable, paramTable, score, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArray, setParam, setParams, setParamsViewArray, setParamTable, transpose, type, validateInputpublic FrozenLayer(Layer insideLayer)
public void setCacheMode(CacheMode mode)
LayersetCacheMode in interface LayersetCacheMode in class BaseWrapperLayerprotected String layerId()
public double calcL2(boolean backpropOnlyParams)
LayercalcL2 in interface LayercalcL2 in class BaseWrapperLayerbackpropOnlyParams - If true: calculate L2 based on backprop params only. If false: calculate
based on all params (including pretrain params, if any)public double calcL1(boolean backpropOnlyParams)
LayercalcL1 in interface LayercalcL1 in class BaseWrapperLayerbackpropOnlyParams - If true: calculate L1 based on backprop params only. If false: calculate
based on all params (including pretrain params, if any)public org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.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 org.nd4j.linalg.api.ndarray.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 org.nd4j.linalg.api.ndarray.INDArray activate(org.nd4j.linalg.api.ndarray.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 Layer clone()
Layerclone in interface Layerclone in class BaseWrapperLayerpublic void fit()
Modelfit in interface Modelfit in class BaseWrapperLayerpublic void update(Gradient gradient)
Modelupdate in interface Modelupdate in class BaseWrapperLayerpublic void update(org.nd4j.linalg.api.ndarray.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(org.nd4j.linalg.api.ndarray.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(org.nd4j.linalg.api.ndarray.INDArray data,
LayerWorkspaceMgr workspaceMgr)
Modelfit in interface Modelfit in class BaseWrapperLayerdata - the data to fit the model topublic Gradient gradient()
ModelModel#computeGradientAndScore() .gradient in interface Modelgradient in class BaseWrapperLayerpublic org.nd4j.linalg.primitives.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()
Copyright © 2018. All rights reserved.