avgPool

fun avgPool(x: DTensor, poolHeight: Int, poolWidth: Int): DTensor

Computes the average of the pool (poolHeight x poolWidth) for each pool in x with a stride of (poolHeight, poolWidth). Requires that dim H on x be divisible by poolHeight and dim W on x be divisible by poolWidth.

Parameters

x

: a tensor of rank 4 and shape NHWC

Example:

val t = FloatTensor(Shape(1, 4, 4, 1), floatArrayOf(1f, 2f, 3f, ..., 16f) AvgPool.avgPool(t, 2, 2).first

FloatTensor(Shape(1, 2, 2, 1), floatArrayOf(3.5f, 5.5f, 11.5f, 13.5f))