max_pool

dragon.vm.tensorflow.nn.max_pool(
  input,
  ksize,
  strides,
  padding='VALID',
  data_format='NHWC',
  name=None
)[source]

Apply the n-dimension max pooling.

  • If data_format is 'NCHW', excepts input shape \((N, C, D1, D2, ...)\), and output shape is \((N, C, D1_{\text{out}}, D2_{\text{out}}, ...)\).
  • If data_format is 'NHWC', excepts input shape \((N, D1, D2, ..., C)\), and output shape is \((N, D1_{\text{out}}, D2_{\text{out}}, ..., C)\).
  • padding could be 'VALID', 'SAME' or explicit padding size.

Examples:

for i in range(3):
    ndim = i + 1
    x = tf.ones((1,) + (2,) * ndim + (2,))
    y = tf.nn.max_pool(x, ksize=(2,) * ndim, strides=2)
    assert y.shape == (1,) + (1,) * ndim + (2,)
Parameters:
  • input (dragon.Tensor) The input tensor.
  • ksize (Union[int, Sequence[int]]) The size of pooling window.
  • strides (Union[int, Sequence[int]]) The stride of pooling window.
  • padding (Union[int, Sequence[int], str], optional, default='VALID') The padding algorithm or size.
  • data_format (str, optional, default='NHWC') 'NCHW' or 'NHWC'.
  • name (str, optional) The operation name.
Returns:

dragon.Tensor The output tensor.