Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comments for ops LastLevelMaxPool to avoid potential confusion #7593

Merged
merged 13 commits into from
May 18, 2023
5 changes: 3 additions & 2 deletions torchvision/ops/feature_pyramid_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def forward(self, x: Dict[str, Tensor]) -> Dict[str, Tensor]:

class LastLevelMaxPool(ExtraFPNBlock):
"""
Applies a max_pool2d on top of the last feature map
Applies a max_pool2d (not actual max_pool2d) on top of the last feature map
"""

def forward(
Expand All @@ -216,7 +216,8 @@ def forward(
names: List[str],
) -> Tuple[List[Tensor], List[str]]:
names.append("pool")
x.append(F.max_pool2d(x[-1], 1, 2, 0))
# Use max pooling to simulate stride 2 subsampling
x.append(F.max_pool2d(x[-1], kernel_size=1, stride=2, padding=0))
return x, names


Expand Down