pytagi.nn.pooling#

Classes#

AvgPool2d

2D Average Pooling Layer.

MaxPool2d

2D Max Pooling Layer.

Module Contents#

class pytagi.nn.pooling.AvgPool2d(kernel_size: int, stride: int = -1, padding: int = 0, padding_type: int = 0)[source]#

Bases: pytagi.nn.base_layer.BaseLayer

2D Average Pooling Layer.

This layer performs 2D average pooling operation. It wraps the C++/CUDA backend cutagi.AvgPool2d.

Initializes the AvgPool2d layer.

Parameters:
  • kernel_size (int) – The size of the pooling window (a single integer for square kernels).

  • stride (int) – The stride of the pooling operation. Default is -1, which typically means stride=kernel_size.

  • padding (int) – The implicit zero padding added to both sides of the input.

  • padding_type (int) – The type of padding to be used (e.g., 0 for zero padding).

get_layer_info() str[source]#

Returns a string containing information about the layer.

get_layer_name() str[source]#

Returns the name of the layer (e.g., ‘AvgPool2d’).

class pytagi.nn.pooling.MaxPool2d(kernel_size: int, stride: int = 1, padding: int = 0, padding_type: int = 0)[source]#

Bases: pytagi.nn.base_layer.BaseLayer

2D Max Pooling Layer.

This layer performs 2D max pooling operation based on the input expected values. It wraps the C++/CUDA backend cutagi.MaxPool2d.

Initializes the MaxPool2d layer.

Parameters:
  • kernel_size (int) – The size of the pooling window (a single integer for square kernels).

  • stride (int) – The stride of the pooling operation. Default is 1.

  • padding (int) – The implicit zero padding added to both sides of the input.

  • padding_type (int) – The type of padding to be used (e.g., 0 for zero padding).

get_layer_info() str[source]#

Returns a string containing information about the layer.

get_layer_name() str[source]#

Returns the name of the layer (e.g., ‘MaxPool2d’).