MCPcopy Create free account
hub / github.com/NVIDIA/DALI / _test_permute_batch

Function _test_permute_batch

dali/test/python/operator_1/test_batch_permute.py:57–71  ·  view source on GitHub ↗
(device, type)

Source from the content-addressed store, hash-verified

55
56
57def _test_permute_batch(device, type):
58 batch_size = 10
59 pipe = Pipeline(batch_size, 4, 0)
60 data = fn.external_source(
61 source=lambda: gen_data(batch_size, type), device=device, layout="abc"
62 )
63 perm = fn.batch_permutation()
64 pipe.set_outputs(data, fn.permute_batch(data, indices=perm), perm)
65
66 for i in range(10):
67 orig, permuted, idxs = pipe.run()
68 idxs = [int(idxs.at(i)) for i in range(batch_size)]
69 orig = orig.as_cpu()
70 ref = [orig.at(idx) for idx in idxs]
71 check_batch(permuted, ref, len(ref), 0, 0, "abc")
72
73
74def test_permute_batch():

Callers

nothing calls this directly

Calls 6

set_outputsMethod · 0.95
runMethod · 0.95
PipelineClass · 0.90
check_batchFunction · 0.90
gen_dataFunction · 0.70
atMethod · 0.45

Tested by

no test coverage detected