Function maxpool
Creates a max pool operation that performs the computation required to implement a max pooling layer.
Parameters
Name | Description |
---|---|
features | A tensor containing a batch of input feature maps. |
dims | An array of pool dims. |
Returns
An operation representing a max pool computation.
Example
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() .as!float;
assert(pooledFeatures == [
5.0f, 4.0f,
0.1f, 3.0f
]);