A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html below:

MaxPool2d — PyTorch 2.8 documentation

Applies a 2D max pooling over an input signal composed of several input planes.

In the simplest case, the output value of the layer with input size ( N , C , H , W ) (N, C, H, W) (N,C,H,W), output ( N , C , H o u t , W o u t ) (N, C, H_{out}, W_{out}) (N,C,Hout,Wout) and kernel_size ( k H , k W ) (kH, kW) (kH,kW) can be precisely described as:

o u t ( N i , C j , h , w ) = max ⁡ m = 0 , … , k H − 1 max ⁡ n = 0 , … , k W − 1 input ( N i , C j , stride[0] × h + m , stride[1] × w + n ) \begin{aligned} out(N_i, C_j, h, w) ={} & \max_{m=0, \ldots, kH-1} \max_{n=0, \ldots, kW-1} \\ & \text{input}(N_i, C_j, \text{stride[0]} \times h + m, \text{stride[1]} \times w + n) \end{aligned} out(Ni,Cj,h,w)=m=0,,kH1maxn=0,,kW1maxinput(Ni,Cj,stride[0]×h+m,stride[1]×w+n)

If padding is non-zero, then the input is implicitly padded with negative infinity on both sides for padding number of points. dilation controls the spacing between the kernel points. It is harder to describe, but this link has a nice visualization of what dilation does.

Note

When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding or the input. Sliding windows that would start in the right padded region are ignored.

The parameters kernel_size, stride, padding, dilation can either be:

Parameters
Shape:

Examples:

>>> # pool of square window of size=3, stride=2
>>> m = nn.MaxPool2d(3, stride=2)
>>> # pool of non-square window
>>> m = nn.MaxPool2d((3, 2), stride=(2, 1))
>>> input = torch.randn(20, 16, 50, 32)
>>> output = m(input)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4