Evaluating Two-Dimensional Pooling Layer Implementation
To validate the programmatic implementation of a two-dimensional pooling layer, one can evaluate the pool2d function using a known input tensor. For instance, consider a input tensor X populated with sequential values from to . Applying a max-pooling layer (the default mode in the implementation) slides the window across the tensor, outputting the maximum value in each region. This results in a output tensor with elements , , , and . Conversely, passing the 'avg' mode argument to the same function calculates the average for each region, producing a tensor with elements , , , and . This practical evaluation confirms that the custom function correctly computes both max and average deterministic aggregations across the input subtensors.
0
1
Tags
D2L
Dive into Deep Learning @ D2L