Skip to content

Commit

Permalink
Merge branch 'master' into phototour-nit
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier committed Mar 3, 2021
2 parents f6a0682 + 89edfaa commit 4248584
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def _create_lmdb(self, root, cls):
folder = f"{cls}_lmdb"

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

with lmdb.open(str(root / folder)) as env, env.begin(write=True) as txn:
Expand Down
3 changes: 3 additions & 0 deletions test/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,9 @@ def test_random_erasing(self):
p_value = stats.binom_test(count_bigger_then_ones, trial, p=0.5)
self.assertGreater(p_value, 0.0001)

# Checking if RandomErasing can be printed as string
t.__repr__()


if __name__ == '__main__':
unittest.main()
1 change: 0 additions & 1 deletion torchvision/transforms/functional_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ def adjust_gamma(img: Tensor, gamma: float, gain: float = 1) -> Tensor:
result = (gain * result ** gamma).clamp(0, 1)

result = convert_image_dtype(result, dtype)
result = result.to(dtype)
return result


Expand Down
8 changes: 8 additions & 0 deletions torchvision/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,14 @@ def forward(self, img):
return F.erase(img, x, y, h, w, v, self.inplace)
return img

def __repr__(self):
s = '(p={}, '.format(self.p)
s += 'scale={}, '.format(self.scale)
s += 'ratio={}, '.format(self.ratio)
s += 'value={}, '.format(self.value)
s += 'inplace={})'.format(self.inplace)
return self.__class__.__name__ + s


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

0 comments on commit 4248584

Please sign in to comment.