public class SameDiffLayer extends AbstractLayer<AbstractSameDiffLayer>
Layer.TrainingMode, Layer.Type
Modifier and Type | Field and Description |
---|---|
protected org.nd4j.linalg.api.ndarray.INDArray |
gradients |
static String |
INPUT_KEY |
protected List<String> |
outputKeys |
protected org.nd4j.linalg.api.ndarray.INDArray |
params |
protected Map<String,org.nd4j.linalg.api.ndarray.INDArray> |
paramTable |
protected org.nd4j.autodiff.samediff.SameDiff |
sameDiff |
cacheMode, conf, dropoutApplied, dropoutMask, epochCount, index, input, iterationCount, maskArray, maskState, preOutput, trainingListeners
Constructor and Description |
---|
SameDiffLayer(NeuralNetConfiguration conf) |
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.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
|
void |
clearNoiseWeightParams() |
Layer |
clone()
Clone the layer
|
protected void |
doInit() |
org.nd4j.linalg.api.ndarray.INDArray |
getGradientsViewArray() |
org.nd4j.linalg.api.ndarray.INDArray |
getParam(String param)
Get the parameter
|
boolean |
isPretrainLayer()
Returns true if the layer can be trained in an unsupervised/pretrain manner (AE, VAE, etc)
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Returns the parameters of the neural network as a flattened row vector
|
Map<String,org.nd4j.linalg.api.ndarray.INDArray> |
paramTable()
The param table
|
Map<String,org.nd4j.linalg.api.ndarray.INDArray> |
paramTable(boolean backpropParamsOnly)
Table of parameters by key, for backprop
For many models (dense layers, etc) - all parameters are backprop parameters
|
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 |
setParam(String key,
org.nd4j.linalg.api.ndarray.INDArray val)
Set the parameter with a new ndarray
|
void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Set the parameters for this model.
|
protected void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params,
char order) |
void |
setParamsViewArray(org.nd4j.linalg.api.ndarray.INDArray params)
Set the initial parameters 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 |
setParamTable(Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable)
Setter for the param table
|
accumulateScore, activate, addListeners, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, batchSize, calcL1, calcL2, clear, computeGradientAndScore, conf, feedForwardMaskArray, fit, fit, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, getOptimizer, gradient, gradientAndScore, init, initParams, input, layerConf, layerId, numParams, numParams, score, setCacheMode, setConf, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, transpose, type, update, update, validateInput
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEpochCount, getIterationCount, setEpochCount, setIterationCount
public static final String INPUT_KEY
protected org.nd4j.autodiff.samediff.SameDiff sameDiff
protected org.nd4j.linalg.api.ndarray.INDArray params
protected org.nd4j.linalg.api.ndarray.INDArray gradients
public SameDiffLayer(NeuralNetConfiguration conf)
public Layer clone()
Layer
clone
in interface Layer
clone
in class AbstractLayer<AbstractSameDiffLayer>
public boolean isPretrainLayer()
Layer
public void clearNoiseWeightParams()
public org.nd4j.linalg.api.ndarray.INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layer
training
- training or test modeworkspaceMgr
- Workspace managerArrayType.ACTIVATIONS
workspace via the workspace managerpublic org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
Layer
epsilon
- 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 params()
params
in interface Model
params
in class AbstractLayer<AbstractSameDiffLayer>
public org.nd4j.linalg.api.ndarray.INDArray getParam(String param)
Model
getParam
in interface Model
getParam
in class AbstractLayer<AbstractSameDiffLayer>
param
- the key of the parameterpublic void setParam(String key, org.nd4j.linalg.api.ndarray.INDArray val)
Model
setParam
in interface Model
setParam
in class AbstractLayer<AbstractSameDiffLayer>
key
- the key to se tval
- the new ndarraypublic void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Model
setParams
in interface Model
setParams
in class AbstractLayer<AbstractSameDiffLayer>
params
- the parameters for the modelprotected void setParams(org.nd4j.linalg.api.ndarray.INDArray params, char order)
setParams
in class AbstractLayer<AbstractSameDiffLayer>
public void setParamsViewArray(org.nd4j.linalg.api.ndarray.INDArray params)
Model
setParamsViewArray
in interface Model
setParamsViewArray
in class AbstractLayer<AbstractSameDiffLayer>
params
- a 1 x nParams row vector that is a view of the larger (MLN/CG) parameters arraypublic org.nd4j.linalg.api.ndarray.INDArray getGradientsViewArray()
getGradientsViewArray
in interface Model
getGradientsViewArray
in class AbstractLayer<AbstractSameDiffLayer>
public void setBackpropGradientsViewArray(org.nd4j.linalg.api.ndarray.INDArray gradients)
Model
setBackpropGradientsViewArray
in interface Model
setBackpropGradientsViewArray
in class AbstractLayer<AbstractSameDiffLayer>
gradients
- a 1 x nParams row vector that is a view of the larger (MLN/CG) gradients arraypublic void setParamTable(Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable)
Model
setParamTable
in interface Model
setParamTable
in class AbstractLayer<AbstractSameDiffLayer>
public Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable()
Model
paramTable
in interface Model
paramTable
in class AbstractLayer<AbstractSameDiffLayer>
public Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable(boolean backpropParamsOnly)
Model
paramTable
in interface Model
paramTable
in class AbstractLayer<AbstractSameDiffLayer>
backpropParamsOnly
- If true, return backprop params only. If false: return all params (equivalent to
paramsTable())protected void doInit()
Copyright © 2018. All rights reserved.