MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_shape

Method test_shape

tests/data/test_patch_dataset.py:31–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29class TestPatchDataset(unittest.TestCase):
30
31 def test_shape(self):
32 test_dataset = ["vwxyz", "hello", "world"]
33 n_per_image = len(test_dataset[0])
34
35 result = PatchDataset(data=test_dataset, patch_func=identity, samples_per_image=n_per_image)
36
37 output = []
38 n_workers = 0 if sys.platform == "win32" else 2
39 for item in DataLoader(result, batch_size=3, num_workers=n_workers):
40 output.append("".join(item))
41 if n_workers == 0:
42 expected = ["vwx", "yzh", "ell", "owo", "rld"]
43 else:
44 expected = ["vwx", "hel", "yzw", "lo", "orl", "d"]
45 self.assertEqual(output, expected)
46
47 def test_loading_array(self):
48 set_determinism(seed=1234)

Callers

nothing calls this directly

Calls 3

PatchDatasetClass · 0.90
DataLoaderClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected