public class ConvolutionLayer extends BaseLayer<ConvolutionLayer>
Layer.TrainingMode, Layer.Type| Modifier and Type | Field and Description |
|---|---|
protected ConvolutionMode |
convolutionMode |
protected INDArray |
dummyBias |
protected INDArray |
dummyBiasGrad |
protected ConvolutionHelper |
helper |
protected int |
helperCountFail |
protected INDArray |
i2d |
gradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, solver, weightNoiseParamscacheMode, conf, dataType, dropoutApplied, epochCount, index, input, inputModificationAllowed, iterationCount, maskArray, maskState, preOutput, trainingListeners| Constructor and Description |
|---|
ConvolutionLayer(NeuralNetConfiguration conf,
DataType dataType) |
| 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
|
Pair<Gradient,INDArray> |
backpropGradient(INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
Pair<INDArray,MaskState> |
feedForwardMaskArray(INDArray maskArray,
MaskState currentMaskState,
int minibatchSize)
Feed forward the input mask array, setting in the layer as appropriate.
|
void |
fit(INDArray input,
LayerWorkspaceMgr workspaceMgr)
Fit the model to the given data
|
LayerHelper |
getHelper() |
boolean |
hasBias()
Does this layer have no bias term? Many layers (dense, convolutional, output, embedding) have biases by
default, but no-bias versions are possible via configuration
|
boolean |
isPretrainLayer()
Returns true if the layer can be trained in an unsupervised/pretrain manner (AE, VAE, etc)
|
protected Pair<INDArray,INDArray> |
preOutput(boolean training,
boolean forBackprop,
LayerWorkspaceMgr workspaceMgr)
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<INDArray,INDArray> |
preOutput4d(boolean training,
boolean forBackprop,
LayerWorkspaceMgr workspaceMgr)
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(INDArray params)
Set the parameters for this model.
|
Layer.Type |
type()
Returns the layer type
|
protected void |
validateInputDepth(long inDepth) |
protected void |
validateInputRank() |
calcRegularizationScore, clear, clearNoiseWeightParams, clone, computeGradientAndScore, fit, getGradientsViewArray, getOptimizer, getParam, getParamWithNoise, gradient, hasLayerNorm, layerConf, numParams, params, paramTable, paramTable, preOutput, preOutputWithPreNorm, score, setBackpropGradientsViewArray, setParam, setParams, setParamsViewArray, setParamTable, setScoreWithZ, toString, update, updateactivate, addListeners, allowInputModification, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, backpropDropOutIfPresent, batchSize, close, conf, getConfig, getEpochCount, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, gradientAndScore, init, input, layerId, numParams, setCacheMode, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, updaterDivideByMinibatchequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetIterationCount, setIterationCountprotected INDArray i2d
protected ConvolutionHelper helper
protected int helperCountFail
protected ConvolutionMode convolutionMode
protected transient INDArray dummyBias
protected transient INDArray dummyBiasGrad
public ConvolutionLayer(NeuralNetConfiguration conf, DataType dataType)
public Layer.Type type()
Layertype in interface Layertype in class AbstractLayer<ConvolutionLayer>public Pair<Gradient,INDArray> backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
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.workspaceMgr - Workspace managerArrayType.ACTIVATION_GRAD workspace via the workspace managerprotected Pair<INDArray,INDArray> preOutput4d(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr)
protected void validateInputRank()
protected void validateInputDepth(long inDepth)
protected Pair<INDArray,INDArray> preOutput(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr)
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 INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layeractivate in interface Layeractivate in class BaseLayer<ConvolutionLayer>training - training or test modeworkspaceMgr - Workspace managerArrayType.ACTIVATIONS workspace via the workspace managerpublic boolean hasBias()
BaseLayerhasBias in class BaseLayer<ConvolutionLayer>public boolean isPretrainLayer()
Layerpublic LayerHelper getHelper()
getHelper in interface LayergetHelper in class AbstractLayer<ConvolutionLayer>public void fit(INDArray input, LayerWorkspaceMgr workspaceMgr)
Modelfit in interface Modelfit in class BaseLayer<ConvolutionLayer>input - the data to fit the model topublic void setParams(INDArray params)
ModelsetParams in interface ModelsetParams in class BaseLayer<ConvolutionLayer>params - the parameters for the modelpublic Pair<INDArray,MaskState> feedForwardMaskArray(INDArray maskArray, MaskState currentMaskState, int minibatchSize)
LayerfeedForwardMaskArray in interface LayerfeedForwardMaskArray in class AbstractLayer<ConvolutionLayer>maskArray - Mask array to setcurrentMaskState - Current state of the mask - see MaskStateminibatchSize - Current minibatch size. Needs to be known as it cannot always be inferred from the activations
array due to reshaping (such as a DenseLayer within a recurrent neural network)Copyright © 2020. All rights reserved.