MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / test_concat_dataset

Function test_concat_dataset

imperative/python/test/unit/data/test_dataset.py:37–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36
37def test_concat_dataset():
38 size1 = (10,)
39 size2 = (20,)
40 data_shape1 = (3, 256, 256)
41 data_shape2 = (2, 128, 128)
42 label_shape1 = (1,)
43 label_shape2 = (2,)
44 data1 = np.random.randint(0, 255, size1 + data_shape1)
45 data2 = np.random.randint(0, 255, size2 + data_shape2)
46 label1 = np.random.randint(0, 9, size1 + label_shape1)
47 label2 = np.random.randint(0, 9, size2 + label_shape2)
48 dataset1 = ArrayDataset(data1, label1)
49 dataset2 = ArrayDataset(data2, label2)
50 dataset = ConcatDataset([dataset1, dataset2])
51 assert dataset[15][0].shape == data_shape2
52 assert dataset[15][1].shape == label_shape2

Callers

nothing calls this directly

Calls 2

ArrayDatasetClass · 0.90
ConcatDatasetClass · 0.90

Tested by

no test coverage detected