Skip to content

Commit

Permalink
add comments for ops LastLevelMaxPool to avoid potential confusion (#…
Browse files Browse the repository at this point in the history
…7593)

Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
  • Loading branch information
kkaiwwana and NicolasHug authored May 18, 2023
1 parent 19b2d3c commit abc40ef
Showing 1 changed file with 3 additions and 2 deletions.
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, we just subsample) 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

0 comments on commit abc40ef

Please sign in to comment.