Skip to content

[proto] Ported all transforms to the new API #6305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
df6918c
[proto] Added few transforms tests, part 1 (#6262)
vfdev-5 Jul 12, 2022
615b175
Added RandomCrop transform and tests (#6271)
vfdev-5 Jul 14, 2022
bb2f4e1
[proto] Added GaussianBlur transform and tests (#6273)
vfdev-5 Jul 15, 2022
5bb8178
Merge branch 'main' of github.com:pytorch/vision into proto-transform…
vfdev-5 Jul 15, 2022
378f3c3
[proto] Added random color transforms and tests (#6275)
vfdev-5 Jul 16, 2022
3a9aca1
Added RandomPerspective and tests (#6284)
vfdev-5 Jul 18, 2022
794443d
Added more functional tests (#6285)
vfdev-5 Jul 18, 2022
247b4e2
Merge branch 'main' of github.com:pytorch/vision into proto-transform…
vfdev-5 Jul 21, 2022
94c7dde
[proto] Added elastic transform and tests (#6295)
vfdev-5 Jul 22, 2022
b7ed683
Try to format code as in https://github.com/pytorch/vision/pull/5106
vfdev-5 Jul 22, 2022
bdc9e7c
Merge branch 'main' of github.com:pytorch/vision into proto-transform…
vfdev-5 Jul 22, 2022
14d221d
Fixed bug in affine get_params test
vfdev-5 Jul 25, 2022
2ee8dca
Implemented RandomErase on PIL input as fallback to tensors (#6309)
vfdev-5 Jul 25, 2022
a8f970e
Merge branch 'main' into proto-transforms-api
vfdev-5 Jul 25, 2022
23112f8
Added image_size computation for BoundingBox.rotate if expand (#6319)
vfdev-5 Jul 27, 2022
2586de6
Added erase_image_pil and eager/jit erase_image_tensor test (#6320)
vfdev-5 Jul 27, 2022
1118c85
Merge branch 'main' into proto-transforms-api
datumbox Jul 27, 2022
c05169f
Merge branch 'main' into proto-transforms-api
datumbox Jul 27, 2022
72b5fd1
Merge branch 'main' of github.com:pytorch/vision into proto-transform…
vfdev-5 Jul 28, 2022
d226e16
Updates according to the review
vfdev-5 Jul 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions test/test_functional_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,16 +1352,24 @@ def test_ten_crop(device):
assert_equal(transformed_batch, s_transformed_batch)


def test_elastic_transform_asserts():
with pytest.raises(TypeError, match="Argument displacement should be a Tensor"):
_ = F.elastic_transform("abc", displacement=None)

with pytest.raises(TypeError, match="img should be PIL Image or Tensor"):
_ = F.elastic_transform("abc", displacement=torch.rand(1))

img_tensor = torch.rand(1, 3, 32, 24)
with pytest.raises(ValueError, match="Argument displacement shape should"):
_ = F.elastic_transform(img_tensor, displacement=torch.rand(1, 2))


@pytest.mark.parametrize("device", cpu_and_gpu())
@pytest.mark.parametrize("interpolation", [NEAREST, BILINEAR, BICUBIC])
@pytest.mark.parametrize("dt", [None, torch.float32, torch.float64, torch.float16])
@pytest.mark.parametrize(
"fill",
[
None,
[255, 255, 255],
(2.0,),
],
[None, [255, 255, 255], (2.0,)],
)
def test_elastic_transform_consistency(device, interpolation, dt, fill):
script_elastic_transform = torch.jit.script(F.elastic_transform)
Expand Down
Loading