public class ConvolutionLayer extends BaseLayer<ConvolutionLayer>
Layer.TrainingMode, Layer.Type
Modifier and Type | Field and Description |
---|---|
protected ConvolutionMode |
convolutionMode |
protected org.nd4j.linalg.api.ndarray.INDArray |
dummyBias |
protected org.nd4j.linalg.api.ndarray.INDArray |
dummyBiasGrad |
protected ConvolutionHelper |
helper |
protected int |
helperCountFail |
protected org.nd4j.linalg.api.ndarray.INDArray |
i2d |
protected static org.slf4j.Logger |
log |
gradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, solver, weightNoiseParams
cacheMode, conf, dropoutApplied, dropoutMask, epochCount, index, input, iterationCount, maskArray, maskState, preOutput, trainingListeners
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,
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 |
fit(org.nd4j.linalg.api.ndarray.INDArray input,
LayerWorkspaceMgr workspaceMgr)
Fit the model to the given data
|
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)
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Returns the parameters of the neural network as a flattened row vector
|
protected org.nd4j.linalg.primitives.Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.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 org.nd4j.linalg.primitives.Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.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(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, calcL1, calcL2, clear, clearNoiseWeightParams, clone, computeGradientAndScore, fit, getGradientsViewArray, getOptimizer, getParam, getParamWithNoise, gradient, initParams, layerConf, numParams, paramTable, paramTable, preOutput, score, setBackpropGradientsViewArray, setParam, setParams, setParamsViewArray, setParamTable, setScoreWithZ, toString, update, update
activate, addListeners, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, batchSize, conf, feedForwardMaskArray, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, gradientAndScore, init, input, layerId, numParams, setCacheMode, setConf, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, validateInput
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEpochCount, getIterationCount, setEpochCount, setIterationCount
protected static final org.slf4j.Logger log
protected org.nd4j.linalg.api.ndarray.INDArray i2d
protected ConvolutionHelper helper
protected int helperCountFail
protected ConvolutionMode convolutionMode
protected transient org.nd4j.linalg.api.ndarray.INDArray dummyBias
protected transient org.nd4j.linalg.api.ndarray.INDArray dummyBiasGrad
public ConvolutionLayer(NeuralNetConfiguration conf)
public ConvolutionLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public Layer.Type type()
Layer
type
in interface Layer
type
in class AbstractLayer<ConvolutionLayer>
public org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
Layer
backpropGradient
in interface Layer
backpropGradient
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 org.nd4j.linalg.primitives.Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> preOutput4d(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr)
protected org.nd4j.linalg.primitives.Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.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 org.nd4j.linalg.api.ndarray.INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layer
activate
in interface Layer
activate
in class BaseLayer<ConvolutionLayer>
training
- training or test modeworkspaceMgr
- Workspace managerArrayType.ACTIVATIONS
workspace via the workspace managerpublic Layer transpose()
Layer
transpose
in interface Layer
transpose
in class BaseLayer<ConvolutionLayer>
public boolean hasBias()
BaseLayer
hasBias
in class BaseLayer<ConvolutionLayer>
public boolean isPretrainLayer()
Layer
public void fit(org.nd4j.linalg.api.ndarray.INDArray input, LayerWorkspaceMgr workspaceMgr)
Model
fit
in interface Model
fit
in class BaseLayer<ConvolutionLayer>
input
- the data to fit the model topublic org.nd4j.linalg.api.ndarray.INDArray params()
BaseLayer
params
in interface Model
params
in class BaseLayer<ConvolutionLayer>
public void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Model
setParams
in interface Model
setParams
in class BaseLayer<ConvolutionLayer>
params
- the parameters for the modelCopyright © 2018. All rights reserved.