Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def residual_block(l, increase_dim=False, projection=False):
block = NonlinearityLayer(ElemwiseSumLayer([stack_2, projection]),nonlinearity=rectify)
else:
# identity shortcut, as option A in paper
identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], s[2]//2, s[3]//2))
identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], int((s[2] + 0.5) // 2), int((s[3] + 0.5) // 2)))
Copy link
Member

@f0k f0k Jul 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, it should have been (s[2]+1)//2. This rounds up and doesn't need an int conversion either. Adding +.5 before the division was wrong, it should have been after the division as in int(s[2]/2. + .5), sorry.

padding = PadLayer(identity, [out_num_filters//4,0,0], batch_ndim=1)
block = NonlinearityLayer(ElemwiseSumLayer([stack_2, padding]),nonlinearity=rectify)
else:
Expand Down