Commit 62cbf0bf authored by Erik Gaasedelen's avatar Erik Gaasedelen Committed by Soumith Chintala
Browse files

move area calculation out of loop (#641)

* move area calculation out of loop

No need to calculate area 10 times when it doesn't change.

* lint
parent 36215690
...@@ -553,8 +553,9 @@ class RandomResizedCrop(object): ...@@ -553,8 +553,9 @@ class RandomResizedCrop(object):
tuple: params (i, j, h, w) to be passed to ``crop`` for a random tuple: params (i, j, h, w) to be passed to ``crop`` for a random
sized crop. sized crop.
""" """
for attempt in range(10):
area = img.size[0] * img.size[1] area = img.size[0] * img.size[1]
for attempt in range(10):
target_area = random.uniform(*scale) * area target_area = random.uniform(*scale) * area
aspect_ratio = random.uniform(*ratio) aspect_ratio = random.uniform(*ratio)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment