Skip to content

Commit 02785c1

Browse files
committed
Added scripted fn save test for random erase (pytorch#2767)
1 parent 3af0a35 commit 02785c1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

test/test_functional_tensor.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,6 @@ def test_perspective(self):
741741
batch_tensors, F.perspective, startpoints=spoints, endpoints=epoints, interpolation=0
742742
)
743743

744-
def test_convert_image_dtype(self):
745-
# TODO: add tests of CPU/CUDA on tensor and batch
746-
pass
747-
748744

749745
@unittest.skipIf(not torch.cuda.is_available(), reason="Skip if no CUDA device")
750746
class CUDATester(Tester):

test/test_transforms_tensor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ def test_random_erasing(self):
490490
self._test_transform_vs_scripted(fn, scripted_fn, tensor)
491491
self._test_transform_vs_scripted_on_batch(fn, scripted_fn, batch_tensors)
492492

493+
with get_tmp_dir() as tmp_dir:
494+
scripted_fn.save(os.path.join(tmp_dir, "t_random_erasing.pt"))
495+
493496
def test_convert_image_dtype(self):
494497
tensor, _ = self._create_data(26, 34, device=self.device)
495498
batch_tensors = torch.rand(4, 3, 44, 56, device=self.device)

0 commit comments

Comments
 (0)