Pooling
simplegrad.functions.pooling.max_pool2d(x: Tensor, kernel_size: int | tuple[int, int], stride: int | tuple[int, int] = None, pad_width: int | tuple[int, int, int] = 0, pad_mode: str = 'constant', pad_value: int = 0) -> Tensor
Apply 2D max pooling over the input tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape |
required |
kernel_size
|
int | tuple[int, int]
|
Pooling window size. Int or |
required |
stride
|
int | tuple[int, int]
|
Step between pooling windows. Int or |
None
|
pad_width
|
int | tuple[int, int, int]
|
Padding before pooling. 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
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape |