Package deepnetts.net.layers
Class MaxPoolingLayer
java.lang.Object
deepnetts.net.layers.AbstractLayer<Tensor3D,Tensor3D,TensorBase>
deepnetts.net.layers.MaxPoolingLayer
- All Implemented Interfaces:
Layer<Tensor3D>
,Serializable
This layer performs max pooling operation in convolutional neural network, which
scales down output from previous layer by taking max outputs from small predefined filter areas.
- Author:
- Zoran Sevarac
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMaxPoolingLayer
(int filterWidth, int filterHeight, int stride) Creates a new max pooling layer with specified filter dimensions and stride.MaxPoolingLayer
(Filter filter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Does nothing for pooling layer since it does not have weights It just propagates deltas from next layer to previous through connections that had max activation in forward passvoid
backward()
backward pass for a max(x, y) operation has a simple interpretation as only routing the gradient to the input that had the highest value in the forward pass.void
forward()
Max pooling forward pass outputs the max value for each filter position.int
int
float
float
int
final void
init()
This method should implement layer initialization in subclasses, when a layer is added to the network (create weights, outputs, deltas, randomization etc.).void
toString()
Methods inherited from class deepnetts.net.layers.AbstractLayer
getActivation, getActivationType, getBatchSize, getBiases, getDeltaBiases, getDeltas, getDeltaWeights, getDepth, getForwardAccelerator, getGradients, getHeight, getL1Regularization, getL2Regularization, getLearningRate, getMode, getMomentum, getNextLayer, getOptimizer, getOptimizerType, getOutputs, getPrevDeltaBiases, getPrevDeltaWeights, getPrevlayer, getWeights, getWidth, isBatchMode, isTrainable, setBatchMode, setBatchSize, setBiases, setCudaHandles, setDeltas, setL1Regularization, setL2Regularization, setLearningRate, setMode, setMomentum, setNextlayer, setOptimizerType, setOutputs, setPrevDeltaWeights, setPrevLayer, setThreadPool, setTrainable, setWeights, setWeights
-
Constructor Details
-
MaxPoolingLayer
public MaxPoolingLayer(int filterWidth, int filterHeight, int stride) Creates a new max pooling layer with specified filter dimensions and stride.- Parameters:
filterWidth
- width of the filter squarefilterHeight
- height of the filter squarestride
- filter step
-
MaxPoolingLayer
-
-
Method Details
-
init
public final void init()Description copied from class:AbstractLayer
This method should implement layer initialization in subclasses, when a layer is added to the network (create weights, outputs, deltas, randomization etc.).- Specified by:
init
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
initTransientFields
public void initTransientFields()- Overrides:
initTransientFields
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
forward
public void forward()Max pooling forward pass outputs the max value for each filter position.- Specified by:
forward
in interfaceLayer<Tensor3D>
- Specified by:
forward
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
backward
public void backward()backward pass for a max(x, y) operation has a simple interpretation as only routing the gradient to the input that had the highest value in the forward pass. Hence, during the forward pass of a pooling layer it is common to keep track of the index of the max activation (sometimes also called the switches) so that gradient routing is efficient during backpropagation.- Specified by:
backward
in interfaceLayer<Tensor3D>
- Specified by:
backward
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
applyWeightChanges
public void applyWeightChanges()Does nothing for pooling layer since it does not have weights It just propagates deltas from next layer to previous through connections that had max activation in forward pass- Specified by:
applyWeightChanges
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
getFilterWidth
public int getFilterWidth() -
getFilterHeight
public int getFilterHeight() -
getStride
public int getStride() -
getL1WeightSum
public float getL1WeightSum()- Overrides:
getL1WeightSum
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
getL2WeightSum
public float getL2WeightSum()- Overrides:
getL2WeightSum
in classAbstractLayer<Tensor3D,
Tensor3D, TensorBase>
-
toString
-