The identity shortcut adds a block's input to its output. That works only when the shapes match. When the channel count or spatial size changes, ResNet uses a 1x1 projection on the shortcut so the addition is valid.
Implement needs_projection(c_in, c_out, stride), returning True when the shortcut cannot be an identity.
Compare the channel counts and check whether the stride is 1.
No results yet
Run your code to check it against the examples, or submit to run every test.