a small bug in resnet model _make_layer() implementation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
Hi guys,
I think there is a small bug in the "_make_layer(self, block, planes, blocks, stride=1)" function (in charge of generating residual blocks at certain resolution) in the ResNet model. This function will just simply discard the odd number of rows and columns in the feature maps in the identity path at the first residual block in a resolution stage when the stride=2 (the case where feature maps get downsampled by 2).
def _make_layer(self, block, planes, blocks, stride=1):
downsample = None
if stride != 1 or self.inplanes != planes * block.expansion:
downsample = nn.Sequential(
#this 1x1 conv with stride 2 will simply discard the odd number of rows and columns in the feature maps in the identity path
conv1x1(self.inplanes, planes * block.expansion, stride),
nn.BatchNorm2d(planes * block.expansion),
)
Please let me know what do you think.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ResNet _make_layer(self, block, planes, blocks, stride=1) entry point and inspect the stride-2 downsample path shown in the report. Reproduce the behavior with feature maps having odd dimensions, then determine the intended identity-path alignment and add a regression test; the issue does not specify the expected correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100