You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@vfdev-5 I see this was introduced at #2816. For h=100, th=101 this will lead to 101<101 which seems wrong. Do you remember if there was a specific reason for adding the +1s or you think it's a bug?
Yes, it is a bug. The condition if h + 1 < th or w + 1 < tw: was derived wrongly fromtorch.randint(0, h - th + 1, size=(1,)) as we need to generate a random int value. h - th + 1 is the upper non-inclusive boundary.
It should be h - th + 1 >= 2 -> h + 1 >= th + 2 -> h >= th + 1 or h > th. We also need to take into account that h == th. Thus, obviously correct condition is if h < th: raise error
🐛 Describe the bug
location:
vision/torchvision/transforms/transforms.py
Line 631 in 112accf
fix:
if h + 1 < th or w + 1 < tw:
==>if h < th or w < tw:
cc @vfdev-5 @datumbox
The text was updated successfully, but these errors were encountered: