Skip to content

AveragePooling2DLayer

Bases: _Pooling2DLayer

An average pooling 2D Layer.

Parameters:

Name Type Description Default
kernel_size int

the size of the kernel

required
stride int

the stride of the pooling

-1
padding int

the padding of the pooling

0

Attributes:

Name Type Description
input_size ModelImageSize

Get the input_size of this layer.

output_size ModelImageSize

Get the output_size of this layer.

Source code in src/safeds/ml/nn/layers/_pooling2d_layer.py
class AveragePooling2DLayer(_Pooling2DLayer):
    """
    An average pooling 2D Layer.

    Parameters
    ----------
    kernel_size:
        the size of the kernel
    stride:
        the stride of the pooling
    padding:
        the padding of the pooling
    """

    def __init__(self, kernel_size: int, *, stride: int = -1, padding: int = 0) -> None:
        super().__init__("avg", kernel_size, stride=stride, padding=padding)

input_size

Get the input_size of this layer.

Returns:

Name Type Description
result ModelImageSize

The amount of values being passed into this layer.

Raises:

Type Description
ValueError

If the input_size is not yet set

output_size

Get the output_size of this layer.

Returns:

Name Type Description
result ModelImageSize

The number of neurons in this layer.

Raises:

Type Description
ValueError

If the input_size is not yet set