public class ConvolutionLayer extends BaseLayer<ConvolutionLayer>
Layer.TrainingMode, Layer.Type| Modifier and Type | Field and Description |
|---|---|
protected ConvolutionMode |
convolutionMode |
protected ConvolutionHelper |
helper |
protected org.nd4j.linalg.api.ndarray.INDArray |
i2d |
protected static org.slf4j.Logger |
log |
gradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, solvercacheMode, conf, dropoutApplied, dropoutMask, index, input, iterationListeners, maskArray, maskState, preOutput| Constructor and Description |
|---|
ConvolutionLayer(NeuralNetConfiguration conf) |
ConvolutionLayer(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray input) |
| Modifier and Type | Method and Description |
|---|---|
org.nd4j.linalg.api.ndarray.INDArray |
activate(boolean training)
Trigger an activation with the last specified input
|
Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> |
backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon)
Calculate the gradient relative to the error in the next layer
|
Gradient |
calcGradient(Gradient layerError,
org.nd4j.linalg.api.ndarray.INDArray indArray)
Calculate the gradient
|
double |
calcL1(boolean backpropParamsOnly)
Calculate the l1 regularization term
0.0 if regularization is not used. |
double |
calcL2(boolean backpropParamsOnly)
Calculate the l2 regularization term
0.0 if regularization is not used. |
void |
fit(org.nd4j.linalg.api.ndarray.INDArray input)
Fit the model to the given data
|
boolean |
isPretrainLayer()
Returns true if the layer can be trained in an unsupervised/pretrain manner (VAE, RBMs etc)
|
void |
merge(Layer layer,
int batchSize)
Averages the given logistic regression from a mini batch into this layer
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Returns the parameters of the neural network as a flattened row vector
|
org.nd4j.linalg.api.ndarray.INDArray |
preOutput(boolean training) |
protected Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> |
preOutput(boolean training,
boolean forBackprop)
PreOutput method that also returns the im2col2d array (if being called for backprop), as this can be re-used
instead of being calculated again.
|
protected Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> |
preOutput4d(boolean training,
boolean forBackprop)
preOutput4d: Used so that ConvolutionLayer subclasses (such as Convolution1DLayer) can maintain their standard
non-4d preOutput method, while overriding this to return 4d activations (for use in backprop) without modifying
the public API
|
void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Set the parameters for this model.
|
Layer |
transpose()
Return a transposed copy of the weights/bias
(this means reverse the number of inputs and outputs on the weights)
|
Layer.Type |
type()
Returns the layer type
|
accumulateScore, activate, activate, activationMean, applyLearningRateScoreDecay, clone, computeGradientAndScore, error, fit, getGradientsViewArray, getOptimizer, getParam, gradient, initParams, iterate, layerConf, numParams, paramTable, paramTable, preOutput, score, setBackpropGradientsViewArray, setParam, setParams, setParamsViewArray, setParamTable, setScoreWithZ, toString, update, updateactivate, activate, activate, addListeners, applyDropOutIfNecessary, applyMask, batchSize, clear, conf, derivativeActivation, feedForwardMaskArray, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, gradientAndScore, init, input, layerId, numParams, preOutput, preOutput, setCacheMode, setConf, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, validateInputprotected static final org.slf4j.Logger log
protected org.nd4j.linalg.api.ndarray.INDArray i2d
protected ConvolutionHelper helper
protected ConvolutionMode convolutionMode
public ConvolutionLayer(NeuralNetConfiguration conf)
public ConvolutionLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public double calcL2(boolean backpropParamsOnly)
LayercalcL2 in interface LayercalcL2 in class BaseLayer<ConvolutionLayer>backpropParamsOnly - 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 backpropParamsOnly)
LayercalcL1 in interface LayercalcL1 in class BaseLayer<ConvolutionLayer>backpropParamsOnly - If true: calculate L1 based on backprop params only. If false: calculate
based on all params (including pretrain params, if any)public Layer.Type type()
Layertype in interface Layertype in class AbstractLayer<ConvolutionLayer>public Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon)
LayerbackpropGradient in interface LayerbackpropGradient in class BaseLayer<ConvolutionLayer>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.protected Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> preOutput4d(boolean training, boolean forBackprop)
public org.nd4j.linalg.api.ndarray.INDArray preOutput(boolean training)
preOutput in class BaseLayer<ConvolutionLayer>protected Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> preOutput(boolean training, boolean forBackprop)
training - Train or test time (impacts dropout)forBackprop - If true: return the im2col2d array for re-use during backprop. False: return null for second
pair entry. Note that it may still be null in the case of CuDNN and the like.public org.nd4j.linalg.api.ndarray.INDArray activate(boolean training)
Layeractivate in interface Layeractivate in class BaseLayer<ConvolutionLayer>training - training or test modepublic Layer transpose()
Layertranspose in interface Layertranspose in class BaseLayer<ConvolutionLayer>public boolean isPretrainLayer()
Layerpublic Gradient calcGradient(Gradient layerError, org.nd4j.linalg.api.ndarray.INDArray indArray)
LayercalcGradient in interface LayercalcGradient in class BaseLayer<ConvolutionLayer>layerError - the layer errorpublic void fit(org.nd4j.linalg.api.ndarray.INDArray input)
Modelfit in interface Modelfit in class BaseLayer<ConvolutionLayer>input - the data to fit the model topublic void merge(Layer layer, int batchSize)
BaseLayermerge in interface Layermerge in class BaseLayer<ConvolutionLayer>layer - the logistic regression layer to average into this layerbatchSize - the batch sizepublic org.nd4j.linalg.api.ndarray.INDArray params()
BaseLayerparams in interface Modelparams in class BaseLayer<ConvolutionLayer>public void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
ModelsetParams in interface ModelsetParams in class BaseLayer<ConvolutionLayer>params - the parameters for the modelCopyright © 2017. All rights reserved.