models.modules.Pool

Contents

models.modules.Pool#

class Pool(type: str, kernel_size: int = 2, stride: int | None = None)[source]#

Bases: LayerGen

Pooling layer generator

Uses modules torch.nn.AvgPool2d, torch.nn.MaxPool2d, SumPool2d.

Parameters:
Raises:

ValueError – Non-existent pool type.

Methods

get

Initializes and returns the network layer

get(in_channels: int) Tuple[Module, int][source]#

Initializes and returns the network layer

Parameters:

in_channels (int) – Number of input channels.

Returns:

The generated module and the number of channels that will be after applying this layer to a tensor with in_channels channels.

Return type:

Tuple[nn.Module, int]