Class ConvolutionLayer
- java.lang.Object
-
- org.deeplearning4j.nn.conf.layers.Layer
-
- org.deeplearning4j.nn.conf.layers.BaseLayer
-
- org.deeplearning4j.nn.conf.layers.FeedForwardLayer
-
- org.deeplearning4j.nn.conf.layers.ConvolutionLayer
-
- All Implemented Interfaces:
Serializable,Cloneable,TrainingConfig
- Direct Known Subclasses:
Convolution1DLayer,Convolution2D,Convolution3D,Deconvolution2D,Deconvolution3D,DepthwiseConvolution2D,SeparableConvolution2D
public class ConvolutionLayer extends FeedForwardLayer
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConvolutionLayer.AlgoModeThe "PREFER_FASTEST" mode will pick the fastest algorithm for the specified parameters from theConvolutionLayer.FwdAlgo,ConvolutionLayer.BwdFilterAlgo, andConvolutionLayer.BwdDataAlgolists, but they may be very memory intensive, so if weird errors occur when using cuDNN, please try the "NO_WORKSPACE" mode.static classConvolutionLayer.BaseConvBuilder<T extends ConvolutionLayer.BaseConvBuilder<T>>static classConvolutionLayer.Builderstatic classConvolutionLayer.BwdDataAlgoThe backward data algorithm to use whenConvolutionLayer.AlgoModeis set to "USER_SPECIFIED".static classConvolutionLayer.BwdFilterAlgoThe backward filter algorithm to use whenConvolutionLayer.AlgoModeis set to "USER_SPECIFIED".static classConvolutionLayer.FwdAlgoThe forward algorithm to use whenConvolutionLayer.AlgoModeis set to "USER_SPECIFIED".
-
Field Summary
Fields Modifier and Type Field Description protected CNN2DFormatcnn2dDataFormatprotected ConvolutionModeconvolutionModeprotected ConvolutionLayer.AlgoModecudnnAlgoModeDefaults to "PREFER_FASTEST", but "NO_WORKSPACE" uses less memory.protected booleancudnnAllowFallbackprotected ConvolutionLayer.BwdDataAlgocudnnBwdDataAlgoprotected ConvolutionLayer.BwdFilterAlgocudnnBwdFilterAlgoprotected ConvolutionLayer.FwdAlgocudnnFwdAlgoprotected int[]dilationprotected booleanhasBiasprotected int[]kernelSizeprotected int[]paddingprotected int[]stride-
Fields inherited from class org.deeplearning4j.nn.conf.layers.FeedForwardLayer
nIn, nOut, timeDistributedFormat
-
Fields inherited from class org.deeplearning4j.nn.conf.layers.BaseLayer
activationFn, biasInit, biasUpdater, gainInit, gradientNormalization, gradientNormalizationThreshold, iUpdater, regularization, regularizationBias, weightInitFn, weightNoise
-
Fields inherited from class org.deeplearning4j.nn.conf.layers.Layer
constraints, iDropout, layerName
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConvolutionLayer(ConvolutionLayer.BaseConvBuilder<?> builder)ConvolutionLayer nIn in the input layer is the number of channels nOut is the number of filters to be used in the net or in other words the channels The builder specifies the filter/kernel size, the stride and padding The pooling layer takes the kernel size
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConvolutionLayerclone()LayerMemoryReportgetMemoryReport(InputType inputType)This is a report of the estimated memory consumption for the given layerInputTypegetOutputType(int layerIndex, InputType inputType)For a given type of input to this layer, what is the type of the output?InputPreProcessorgetPreProcessorForInputType(InputType inputType)For the given type of input to this layer, what preprocessor (if any) is required?
Returns null if no preprocessor is required, otherwise returns an appropriateInputPreProcessorfor this layer, such as aCnnToFeedForwardPreProcessorbooleanhasBias()ParamInitializerinitializer()Layerinstantiate(NeuralNetConfiguration conf, Collection<TrainingListener> trainingListeners, int layerIndex, INDArray layerParamsView, boolean initializeParams, DataType networkDataType)voidsetNIn(InputType inputType, boolean override)Set the nIn value (number of inputs, or input channels for CNNs) based on the given input type-
Methods inherited from class org.deeplearning4j.nn.conf.layers.FeedForwardLayer
isPretrainParam
-
Methods inherited from class org.deeplearning4j.nn.conf.layers.BaseLayer
getGradientNormalization, getRegularizationByParam, getUpdaterByParam, resetLayerDefaultConfig
-
Methods inherited from class org.deeplearning4j.nn.conf.layers.Layer
initializeConstraints, setDataType
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.deeplearning4j.nn.api.TrainingConfig
getGradientNormalizationThreshold, getLayerName
-
-
-
-
Field Detail
-
hasBias
protected boolean hasBias
-
convolutionMode
protected ConvolutionMode convolutionMode
-
dilation
protected int[] dilation
-
kernelSize
protected int[] kernelSize
-
stride
protected int[] stride
-
padding
protected int[] padding
-
cudnnAllowFallback
protected boolean cudnnAllowFallback
-
cnn2dDataFormat
protected CNN2DFormat cnn2dDataFormat
-
cudnnAlgoMode
protected ConvolutionLayer.AlgoMode cudnnAlgoMode
Defaults to "PREFER_FASTEST", but "NO_WORKSPACE" uses less memory.
-
cudnnFwdAlgo
protected ConvolutionLayer.FwdAlgo cudnnFwdAlgo
-
cudnnBwdFilterAlgo
protected ConvolutionLayer.BwdFilterAlgo cudnnBwdFilterAlgo
-
cudnnBwdDataAlgo
protected ConvolutionLayer.BwdDataAlgo cudnnBwdDataAlgo
-
-
Constructor Detail
-
ConvolutionLayer
protected ConvolutionLayer(ConvolutionLayer.BaseConvBuilder<?> builder)
ConvolutionLayer nIn in the input layer is the number of channels nOut is the number of filters to be used in the net or in other words the channels The builder specifies the filter/kernel size, the stride and padding The pooling layer takes the kernel size
-
-
Method Detail
-
hasBias
public boolean hasBias()
-
clone
public ConvolutionLayer clone()
-
instantiate
public Layer instantiate(NeuralNetConfiguration conf, Collection<TrainingListener> trainingListeners, int layerIndex, INDArray layerParamsView, boolean initializeParams, DataType networkDataType)
- Specified by:
instantiatein classLayer
-
initializer
public ParamInitializer initializer()
- Specified by:
initializerin classLayer- Returns:
- The parameter initializer for this model
-
getOutputType
public InputType getOutputType(int layerIndex, InputType inputType)
Description copied from class:LayerFor a given type of input to this layer, what is the type of the output?- Overrides:
getOutputTypein classFeedForwardLayer- Parameters:
layerIndex- Index of the layerinputType- Type of input for the layer- Returns:
- Type of output from the layer
-
setNIn
public void setNIn(InputType inputType, boolean override)
Description copied from class:LayerSet the nIn value (number of inputs, or input channels for CNNs) based on the given input type- Overrides:
setNInin classFeedForwardLayer- Parameters:
inputType- Input type for this layeroverride- If false: only set the nIn value if it's not already set. If true: set it regardless of whether it's already set or not.
-
getPreProcessorForInputType
public InputPreProcessor getPreProcessorForInputType(InputType inputType)
Description copied from class:LayerFor the given type of input to this layer, what preprocessor (if any) is required?
Returns null if no preprocessor is required, otherwise returns an appropriateInputPreProcessorfor this layer, such as aCnnToFeedForwardPreProcessor- Overrides:
getPreProcessorForInputTypein classFeedForwardLayer- Parameters:
inputType- InputType to this layer- Returns:
- Null if no preprocessor is required, otherwise the type of preprocessor necessary for this layer/input combination
-
getMemoryReport
public LayerMemoryReport getMemoryReport(InputType inputType)
Description copied from class:LayerThis is a report of the estimated memory consumption for the given layer- Specified by:
getMemoryReportin classLayer- Parameters:
inputType- Input type to the layer. Memory consumption is often a function of the input type- Returns:
- Memory report for the layer
-
-