maxpool

Creates a max pool operation that performs the computation required to implement a max pooling layer.

maxpool
(,
size_t[] dims
,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

features Operation

A tensor containing a batch of input feature maps.

dims size_t[]

An array of pool dims.

Return Value

Type: Operation

An operation representing a max pool computation.

Examples

import dopt.core : evaluate;

auto features = float32([1, 1, 4, 4], [
    1.0f, 2.0f, 4.0f, 3.0f,
    5.0f, 3.0f, 2.0f, 2.0f,
    0.1f, -4.0f, 3.0f, 2.0f,
    0.0f, 0.0f, 2.0f, 2.0f
]);

auto result = features.maxpool([2,2]);

auto pooledFeatures = result.evaluate().get!float;

assert(pooledFeatures == [
    5.0f, 4.0f,
    0.1f, 3.0f
]);

Meta