Skip to content

Conversation

@matteopresutto
Copy link

Shape division was rounded down, but when the dimension is odd it should be rounded up

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(math.ceil(float(s[2])/2)), int(math.ceil(float(s[3])/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.

math was never imported, though. What about a simpler int((s[2] + 0.5) // 2)?
Or int(np.ceil(s[2] * 0.5))?

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.

@f0k
Copy link
Member

f0k commented Jul 6, 2016

Perfect, thanks. Can you squash this into a single commit?

git reset --soft 41ed700
git commit --amend --no-edit
git push --force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants