# MaxPool¶

MaxPool  // MaxPool operations


## Description¶

Batched max pooling operation, with optional padding and window stride.

### Inputs¶

Name Element Type Shape
arg any $$(N, C, d_1, \ldots, d_n)$$

### Attributes¶

Name Description
window_shape The window shape.
window_movement_strides The window movement strides. (defaults to 1s)
padding_below The below-padding shape. (defaults to 0s)
padding_above The above-padding shape. (defaults to 0s)

### Outputs¶

Name Element Type Shape
output same as arg $$(N,C,d'_1,\ldots,d'_n)$$

The input for max pooling is a data batch tensor of shape $$(N,C,d_1,\dots,d_n)$$ where $$n > 0$$, every $$d_i > 0$$, and where $$N$$ is the batch size, and $$C > 0$$ is the number of channels (sometimes called features). The dimensions $$(d_1,\dots,d_n)$$ correspond to the shape of an $$n$$-dimensional data item in a batch. For example, where $$n=2$$, the data may represent a two-dimensional image. It also has two attributes:

1. the window shape a size vector $$(w_1,\ldots,w_n)$$ where every $$w_i \le d_i$$; and
2. the window movement strides, optional a vector of positive integers $$(s_1,\dots,s_n)$$.

The output has the shape $$(N,C,d'_1,\ldots,d'_n)$$, where $$d'_n = \lceil \frac{d_i - w_i + 1}{s_i} \rceil$$.

## Mathematical Definition¶

Given an input data batch tensor $$T_{in}$$, the output tensor is defined by the equation

$T_{out}[a,c,i_1,\dots,i_n] = \max_{j_1 = s_1 i_1, \dots, j_n = s_n i_n}^{j_1 = s_1 i_1 + w_1 - 1, \dots, j_n = s_n i_n + w_n - 1} (T_{in}[a,c,j_1,\dots,j_n])$

## C++ Interface¶

class MaxPool : public ngraph::op::Op

Batched max pooling operation, with optional padding and window stride.

Public Functions

const std::string &description() const

Get the string name for the type of the node, such as Add or Multiply. The class name, must not contain spaces as it is used for codegen.

Return
A const reference to the node’s type name

MaxPool()

Constructs a batched max pooling operation.

MaxPool(const Output<Node> &arg, const Shape &window_shape, const Strides &window_movement_strides, const Shape &padding_below, const Shape &padding_above, const PadType &pad_type, bool ceil_mode)

Constructs a batched max pooling operation.

Parameters
• arg: The node producing the input data batch tensor.
• window_shape: The window shape.
• window_movement_strides: The window movement strides.
• padding_below: The below-padding shape.
• padding_above: The above-padding shape.
• pad_type: The pad type for automatically computing padding sizes
• ceil_mode: Whether to use ceiling while computing output shape.

MaxPool(const Output<Node> &arg, const Shape &window_shape, const Strides &window_movement_strides, const Shape &padding_below, const Shape &padding_above, const PadType &pad_type)

Constructs a batched max pooling operation.

Parameters
• arg: The node producing the input data batch tensor.
• window_shape: The window shape.
• window_movement_strides: The window movement strides.
• padding_below: The below-padding shape.
• padding_above: The above-padding shape.
• pad_type: The pad type for automatically computing padding sizes

MaxPool(const Output<Node> &arg, const Shape &window_shape, const Strides &window_movement_strides, const Shape &padding_below, const Shape &padding_above)

Constructs a batched max pooling operation.

Parameters
• arg: The node producing the input data batch tensor.
• window_shape: The window shape.
• window_movement_strides: The window movement strides.
• padding_below: The below-padding shape.
• padding_above: The above-padding shape.

void validate_and_infer_types()

Throws if the node is invalid.

MaxPool(const Output<Node> &arg, const Shape &window_shape, const Strides &window_movement_strides)

Constructs a batched, unpadded max pooling operation (i.e., all padding shapes are set to 0).

Parameters
• arg: The node producing the input data batch tensor.
• window_shape: The window shape.
• window_movement_strides: The window movement strides.

MaxPool(const Output<Node> &arg, const Shape &window_shape)

Constructs an unstrided batched max pooling operation (i.e., all window movement strides are 1 and all padding shapes are set to 0).

Parameters
• arg: The node producing the input data batch tensor.
• window_shape: The window shape.

const Shape &get_window_shape() const

Return
The window shape.

const Strides &get_window_movement_strides() const

Return
The window movement strides.

const Shape &get_padding_below() const

Return

const Shape &get_padding_above() const

Return

const PadType &get_pad_type() const

Return
bool get_ceil_mode() const
virtual std::shared_ptr<Node> get_default_value() const