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

Function _test_indexing

dali/test/python/operator_2/test_subscript.py:44–54  ·  view source on GitHub ↗
(data_gen, input_layout, output_layout, dali_index_func, ref_index_func=None)

Source from the content-addressed store, hash-verified

42
43
44def _test_indexing(data_gen, input_layout, output_layout, dali_index_func, ref_index_func=None):
45 src = fn.external_source(data_gen, layout=input_layout)
46 pipe = index_pipe(src, dali_index_func)
47 inp, cpu, gpu = tuple(out.as_cpu() for out in pipe.run())
48 for i in range(len(inp)):
49 x = inp.at(i)
50 ref = (ref_index_func or dali_index_func)(x)
51 assert np.array_equal(ref, cpu.at(i))
52 assert np.array_equal(ref, gpu.at(i))
53 assert cpu.layout() == output_layout
54 assert gpu.layout() == output_layout
55
56
57def test_constant_ranges():

Callers

nothing calls this directly

Calls 4

index_pipeFunction · 0.85
runMethod · 0.45
atMethod · 0.45
layoutMethod · 0.45

Tested by

no test coverage detected