inox.nn.pooling#

Pooling layers

Classes#

AvgPool

Creates an average spatial pooling layer.

MaxPool

Creates a maximum spatial pooling layer.

Descriptions#

class inox.nn.pooling.AvgPool(window_size, stride=None, padding=0)#

Creates an average spatial pooling layer.

Parameters:
  • window_size (Sequence[int]) – The size of the pooling window in each spatial axis.

  • stride (int | Sequence[int]) – The stride coefficient in each spatial axis.

  • padding (int | Sequence[Tuple[int, int]]) – The padding applied to each end of each spatial axis.

__call__(x)#
Parameters:

x (Array) – The input tensor \(x\), with shape \((*, H_1, \dots, H_n, C)\).

Returns:

The output tensor \(y\), with shape \((*, H_1', \dots, H_n', C)\), such that

\[H_i' = \left\lfloor \frac{H_i - k_i + p_i}{s_i} + 1 \right\rfloor\]

where \(k_i\), \(s_i\) and \(p_i\) are respectively the window size, the stride coefficient and the total padding of the \(i\)-th spatial axis.

Return type:

Array

class inox.nn.pooling.MaxPool(window_size, stride=None, padding=0)#

Creates a maximum spatial pooling layer.

Parameters:
  • window_size (Sequence[int]) – The size of the pooling window in each spatial axis.

  • stride (int | Sequence[int]) – The stride coefficient in each spatial axis.

  • padding (int | Sequence[Tuple[int, int]]) – The padding applied to each end of each spatial axis.

__call__(x)#
Parameters:

x (Array) – The input tensor \(x\), with shape \((*, H_1, \dots, H_n, C)\).

Returns:

The output tensor \(y\), with shape \((*, H_1', \dots, H_n', C)\), such that

\[H_i' = \left\lfloor \frac{H_i - k_i + p_i}{s_i} + 1 \right\rfloor\]

where \(k_i\), \(s_i\) and \(p_i\) are respectively the window size, the stride coefficient and the total padding of the \(i\)-th spatial axis.

Return type:

Array