pool2d

dragon.nn.pool2d(
  inputs,
  kernel_shape,
  strides,
  pads=0,
  padding='VALID',
  ceil_mode=False,
  mode='max',
  data_format='NCHW',
  global_pooling=False,
  **kwargs
)[source]

Apply the 2d pooling.

Set padding to VALID will use the value of pads.

If global_pooling is True, strides and pads will be set to 1 and 0.

Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • kernel_shape (Sequence[int]) – The shape of pooling kernel.
  • strides (Sequence[int]) – The stride(s) of of pooling,
  • pads (Sequence[int], optional, default=0) – The zero padding size(s) of pooling.
  • padding ({'VALID', 'SAME', 'SAME_UPPER', 'SAME_LOWER'}, optional) – The padding algorithm.
  • ceil_mode (bool, optional, default=False) – Whether to ceil the boundary.
  • mode ({'MAX', 'AVG'}, optional) – The pooling mode.
  • data_format ({'NCHW', 'NHWC'}, optional) – The optional data format.
  • global_pooling (bool, optional, default=False) – Whether to apply the global pooling.
Returns:

dragon.Tensor – The output tensor.