Shortcuts

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, or None which means the size will be the same as that of the input.

  • kernel_size (int) – Temporal kernel size to use for forward_step and forward_steps.

  • temporal_fill (PaddingMode) – How temporal states are initialized.

Shape:
  • Input: (N,C,Tin,Win)(N, C, T_{in}, W_{in}).

  • Output: (N,C,S0,S1)(N, C, S_{0}, S_{1}), where S=output_sizeS=\text{output\_size}.

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))
Read the Docs v: latest
Versions
latest
stable
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.