AdaptiveMaxPool2d¶
- class continual.AdaptiveMaxPool2d(output_size, kernel_size, stride=1, padding=0, dilation=1, temporal_fill='zeros')[source]¶
Applies a Continual 2D adaptive max pooling over an input signal composed of several input planes.
The output is of size T x W, for any input size. The pooling over the T dimension is continual (progressively cached) and the other is regular. During continual inference, the temporal pooling size is determined by the
kernel_size
. The number of output features is equal to the number of input planes.- Parameters:
output_size (Union[int, None, Tuple[Optional[int], Optional[int]]]) – the target output size of the image of the form T x W. Can be a tuple (T, W) or a single T for a square image T x T. T and W can be either a
int
, orNone
which means the size will be the same as that of the input.kernel_size (int) – Temporal kernel size to use for
forward_step
andforward_steps
.temporal_fill (PaddingMode) – How temporal states are initialized.
- Shape:
Input: .
Output: , where .
Examples:
# target output size of 1x1 m = co.AdaptiveMaxPool2d((1, 1), kernel_size=5) x = torch.randn(1, 64, 5, 16) assert torch.allclose(m.forward(x), m.forward_steps(x))