Skip to content

Commit db7f0ce

Browse files
committed
Merge branch 'master' into flickr-tests
2 parents 83b50dd + 89edfaa commit db7f0ce

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

test/test_datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ def _create_lmdb(self, root, cls):
988988
folder = f"{cls}_lmdb"
989989

990990
num_images = torch.randint(1, 4, size=()).item()
991-
format = "webp"
991+
format = "png"
992992
files = datasets_utils.create_image_folder(root, folder, lambda idx: f"{idx}.{format}", num_images)
993993

994994
with lmdb.open(str(root / folder)) as env, env.begin(write=True) as txn:

test/test_transforms.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,6 +1991,9 @@ def test_random_erasing(self):
19911991
p_value = stats.binom_test(count_bigger_then_ones, trial, p=0.5)
19921992
self.assertGreater(p_value, 0.0001)
19931993

1994+
# Checking if RandomErasing can be printed as string
1995+
t.__repr__()
1996+
19941997

19951998
if __name__ == '__main__':
19961999
unittest.main()

torchvision/transforms/functional_tensor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ def adjust_gamma(img: Tensor, gamma: float, gain: float = 1) -> Tensor:
227227
result = (gain * result ** gamma).clamp(0, 1)
228228

229229
result = convert_image_dtype(result, dtype)
230-
result = result.to(dtype)
231230
return result
232231

233232

torchvision/transforms/transforms.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,14 @@ def forward(self, img):
16301630
return F.erase(img, x, y, h, w, v, self.inplace)
16311631
return img
16321632

1633+
def __repr__(self):
1634+
s = '(p={}, '.format(self.p)
1635+
s += 'scale={}, '.format(self.scale)
1636+
s += 'ratio={}, '.format(self.ratio)
1637+
s += 'value={}, '.format(self.value)
1638+
s += 'inplace={})'.format(self.inplace)
1639+
return self.__class__.__name__ + s
1640+
16331641

16341642
class GaussianBlur(torch.nn.Module):
16351643
"""Blurs image with randomly chosen Gaussian blur.

0 commit comments

Comments
 (0)