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

Function test_plain_indexing

dali/test/python/operator_2/test_subscript.py:33–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32
33def test_plain_indexing():
34 data = [np.float32([[0, 1, 2], [3, 4, 5]]), np.float32([[0, 1], [2, 3], [4, 5]])]
35 src = fn.external_source(lambda: data, layout="AB")
36 pipe = index_pipe(src, lambda x: x[1, 1])
37 inp, cpu, gpu = tuple(out.as_cpu() for out in pipe.run())
38 for i in range(len(inp)):
39 x = inp.at(i)
40 assert np.array_equal(x[1, 1], cpu.at(i))
41 assert np.array_equal(x[1, 1], gpu.at(i))
42
43
44def _test_indexing(data_gen, input_layout, output_layout, dali_index_func, ref_index_func=None):

Callers

nothing calls this directly

Calls 4

index_pipeFunction · 0.85
float32Method · 0.80
runMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected