(data_gen, input_layout, output_layout, dali_index_func, ref_index_func=None)
| 42 | |
| 43 | |
| 44 | def _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 | |
| 57 | def test_constant_ranges(): |
nothing calls this directly
no test coverage detected