MaxPool2d
simplegrad.nn.pooling.MaxPool2d
Bases: Module
2D max pooling layer.
Slides a window over the input and keeps the maximum value in each window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel_size
|
int | tuple
|
Pooling window size. Int or |
required |
stride
|
int | tuple
|
Step between windows. Int or |
required |
pad_width
|
int | tuple[int]
|
Padding. Int (all sides) or |
0
|
pad_mode
|
str
|
Padding mode. Defaults to |
'constant'
|
pad_value
|
int
|
Fill value for constant padding. Defaults to 0. |
0
|
Source code in simplegrad/nn/pooling.py
forward(x: Tensor) -> Tensor
Apply max pooling to the input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input of shape |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Pooled output of shape |