Class SubsamplingLayer.BaseSubsamplingBuilder<T extends SubsamplingLayer.BaseSubsamplingBuilder<T>>
- java.lang.Object
-
- org.deeplearning4j.nn.conf.layers.Layer.Builder<T>
-
- org.deeplearning4j.nn.conf.layers.SubsamplingLayer.BaseSubsamplingBuilder<T>
-
- Direct Known Subclasses:
Subsampling1DLayer.Builder
,SubsamplingLayer.Builder
- Enclosing class:
- SubsamplingLayer
protected abstract static class SubsamplingLayer.BaseSubsamplingBuilder<T extends SubsamplingLayer.BaseSubsamplingBuilder<T>> extends Layer.Builder<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
avgPoolIncludePadInDivisor
protected CNN2DFormat
cnn2DFormat
Configure the 2d data formatprotected ConvolutionMode
convolutionMode
Set the convolution mode for the Convolution layer.protected boolean
cudnnAllowFallback
When using CuDNN and an error is encountered, should fallback to the non-CuDNN implementatation be allowed? If set to false, an exception in CuDNN will be propagated back to the user.protected double
eps
protected int[]
kernelSize
protected int[]
padding
protected int
pnorm
protected PoolingType
poolingType
protected int[]
stride
-
Fields inherited from class org.deeplearning4j.nn.conf.layers.Layer.Builder
allParamConstraints, biasConstraints, iDropout, layerName, weightConstraints
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseSubsamplingBuilder(int... kernelSize)
protected
BaseSubsamplingBuilder(int[] kernelSize, int[] stride)
protected
BaseSubsamplingBuilder(int[] kernelSize, int[] stride, int[] padding)
protected
BaseSubsamplingBuilder(PoolingType poolingType)
protected
BaseSubsamplingBuilder(PoolingType poolingType, int[] kernelSize)
protected
BaseSubsamplingBuilder(PoolingType poolingType, int[] kernelSize, int[] stride, int[] padding)
protected
BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType)
protected
BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType, int[] kernelSize)
protected
BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType, int[] kernelSize, int[] stride)
protected
BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType, int[] kernelSize, int[] stride, int[] padding)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract boolean
allowCausal()
T
avgPoolIncludePadInDivisor(boolean avgPoolIncludePadInDivisor)
When doing average pooling, should the padding values be included in the divisor or not?
Not applicable for max and p-norm pooling.
Users should not usually set this - instead, leave it as the default (false).T
convolutionMode(ConvolutionMode convolutionMode)
Set the convolution mode for the Convolution layer.T
cudnnAllowFallback(boolean allowFallback)
Deprecated.T
dataFormat(CNN2DFormat cnn2DFormat)
Set the data format for the CNN activations - NCHW (channels first) or NHWC (channels last).T
eps(double eps)
T
helperAllowFallback(boolean allowFallback)
When using CuDNN or MKLDNN and an error is encountered, should fallback to the non-helper implementation be allowed? If set to false, an exception in the helper will be propagated back to the user.T
pnorm(int pnorm)
T
poolingType(PoolingType poolingType)
T
poolingType(SubsamplingLayer.PoolingType poolingType)
void
setConvolutionMode(ConvolutionMode convolutionMode)
void
setEps(double eps)
void
setPnorm(int pnorm)
-
Methods inherited from class org.deeplearning4j.nn.conf.layers.Layer.Builder
build, constrainAllParameters, constrainBias, constrainWeights, dropOut, dropOut, name
-
-
-
-
Field Detail
-
poolingType
protected PoolingType poolingType
-
kernelSize
protected int[] kernelSize
-
stride
protected int[] stride
-
padding
protected int[] padding
-
convolutionMode
protected ConvolutionMode convolutionMode
Set the convolution mode for the Convolution layer. SeeConvolutionMode
for more details Convolution mode for layer
-
pnorm
protected int pnorm
-
eps
protected double eps
-
cudnnAllowFallback
protected boolean cudnnAllowFallback
When using CuDNN and an error is encountered, should fallback to the non-CuDNN implementatation be allowed? If set to false, an exception in CuDNN will be propagated back to the user. If false, the built-in (non-CuDNN) implementation for ConvolutionLayer will be used Whether fallback to non-CuDNN implementation should be used
-
avgPoolIncludePadInDivisor
protected boolean avgPoolIncludePadInDivisor
-
cnn2DFormat
protected CNN2DFormat cnn2DFormat
Configure the 2d data format
-
-
Constructor Detail
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType, int[] kernelSize, int[] stride)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType, int[] kernelSize)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType, int[] kernelSize, int[] stride, int[] padding)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(PoolingType poolingType, int[] kernelSize)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(PoolingType poolingType, int[] kernelSize, int[] stride, int[] padding)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(int[] kernelSize, int[] stride, int[] padding)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(int[] kernelSize, int[] stride)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(int... kernelSize)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(SubsamplingLayer.PoolingType poolingType)
-
BaseSubsamplingBuilder
protected BaseSubsamplingBuilder(PoolingType poolingType)
-
-
Method Detail
-
setPnorm
public void setPnorm(int pnorm)
-
setEps
public void setEps(double eps)
-
allowCausal
protected abstract boolean allowCausal()
-
setConvolutionMode
public void setConvolutionMode(ConvolutionMode convolutionMode)
-
dataFormat
public T dataFormat(CNN2DFormat cnn2DFormat)
Set the data format for the CNN activations - NCHW (channels first) or NHWC (channels last). SeeCNN2DFormat
for more details.
Default: NCHW- Parameters:
cnn2DFormat
- Format for activations (in and out)
-
convolutionMode
public T convolutionMode(ConvolutionMode convolutionMode)
Set the convolution mode for the Convolution layer. SeeConvolutionMode
for more details- Parameters:
convolutionMode
- Convolution mode for layer
-
poolingType
public T poolingType(SubsamplingLayer.PoolingType poolingType)
-
poolingType
public T poolingType(PoolingType poolingType)
-
pnorm
public T pnorm(int pnorm)
-
eps
public T eps(double eps)
-
cudnnAllowFallback
@Deprecated public T cudnnAllowFallback(boolean allowFallback)
Deprecated.When using CuDNN or MKLDNN and an error is encountered, should fallback to the non-helper implementation be allowed? If set to false, an exception in the helper will be propagated back to the user. If true, the built-in (non-MKL/CuDNN) implementation for ConvolutionLayer will be used- Parameters:
allowFallback
- Whether fallback to non-CuDNN implementation should be used
-
helperAllowFallback
public T helperAllowFallback(boolean allowFallback)
When using CuDNN or MKLDNN and an error is encountered, should fallback to the non-helper implementation be allowed? If set to false, an exception in the helper will be propagated back to the user. If true, the built-in (non-MKL/CuDNN) implementation for SubsamplingLayer will be used- Parameters:
allowFallback
- Whether fallback to non-CuDNN implementation should be used
-
avgPoolIncludePadInDivisor
public T avgPoolIncludePadInDivisor(boolean avgPoolIncludePadInDivisor)
When doing average pooling, should the padding values be included in the divisor or not?
Not applicable for max and p-norm pooling.
Users should not usually set this - instead, leave it as the default (false). It is included mainly for backward compatibility of older models
Consider the following 2x2 segment along the right side of the image:
[A, P] [B, P]
Where A and B are actual values, and P is padding (0).
With avgPoolIncludePadInDivisor = true, we have: out = (A+B+0+0)/4
With avgPoolIncludePadInDivisor = false, we have: out = (A+B+0+0)/2
Earlier versions of DL4J originally included padding in the count, newer versions exclude it.- Parameters:
avgPoolIncludePadInDivisor
- Whether the divisor should include or exclude padding for average pooling
-
-