AvgPool2d

class AvgPool2d<T : DType, V>(val kernelSize: Pair<Int, Int>, val stride: Pair<Int, Int> = kernelSize, val padding: Pair<Int, Int> = 0 to 0, val countIncludePad: Boolean = true, val name: String = "AvgPool2d") : Module<T, V> (source)

2D Average Pooling layer that applies an average pooling operation over 2D input.

Average pooling reduces the spatial dimensions of the input by computing the mean value in each pooling window. This is often used as an alternative to max pooling and can help preserve more information about the input.

Parameters

kernelSize

Size of the pooling window (height, width)

stride

Stride of the pooling operation (default: same as kernelSize)

padding

Padding added to all sides of the input (default: 0, 0)

countIncludePad

Whether to include padding in the average calculation (default: true)

name

Name of the module

Constructors

Link copied to clipboard
constructor(kernelSize: Pair<Int, Int>, stride: Pair<Int, Int> = kernelSize, padding: Pair<Int, Int> = 0 to 0, countIncludePad: Boolean = true, name: String = "AvgPool2d")

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val modules: List<Module<T, V>>
Link copied to clipboard
open override val name: String
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun forward(input: Tensor<T, V>, ctx: ExecutionContext): Tensor<T, V>
Link copied to clipboard
fun outputSize(inputSize: Pair<Int, Int>): Pair<Int, Int>

Calculates the output size for a given input size and pooling parameters.