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, validateInputequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEpochCount, getIterationCount, setEpochCount, setIterationCountpublic 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()
Layerclone in interface Layerclone in class AbstractLayer<AbstractSameDiffLayer>public boolean isPretrainLayer()
Layerpublic void clearNoiseWeightParams()
public org.nd4j.linalg.api.ndarray.INDArray activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Layertraining - 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)
Layerepsilon - 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 Modelparams in class AbstractLayer<AbstractSameDiffLayer>public org.nd4j.linalg.api.ndarray.INDArray getParam(String param)
ModelgetParam in interface ModelgetParam in class AbstractLayer<AbstractSameDiffLayer>param - the key of the parameterpublic void setParam(String key, org.nd4j.linalg.api.ndarray.INDArray val)
ModelsetParam in interface ModelsetParam in class AbstractLayer<AbstractSameDiffLayer>key - the key to se tval - the new ndarraypublic void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
ModelsetParams in interface ModelsetParams 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)
ModelsetParamsViewArray in interface ModelsetParamsViewArray 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 ModelgetGradientsViewArray in class AbstractLayer<AbstractSameDiffLayer>public void setBackpropGradientsViewArray(org.nd4j.linalg.api.ndarray.INDArray gradients)
ModelsetBackpropGradientsViewArray in interface ModelsetBackpropGradientsViewArray 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)
ModelsetParamTable in interface ModelsetParamTable in class AbstractLayer<AbstractSameDiffLayer>public Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable()
ModelparamTable in interface ModelparamTable in class AbstractLayer<AbstractSameDiffLayer>public Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable(boolean backpropParamsOnly)
ModelparamTable in interface ModelparamTable 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.