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

Function test_empty_slice

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

Source from the content-addressed store, hash-verified

296
297
298def test_empty_slice():
299 data = [np.full((4, 5), 123), np.full((0, 1), 42)]
300 src = fn.external_source(lambda: data)
301 pipe = index_pipe(src, lambda x: x[0:0, 0:1])
302 inp, cpu, gpu = tuple(out.as_cpu() for out in pipe.run())
303 for i in range(len(inp)):
304 x = inp.at(i)
305 assert np.array_equal(x[0:0, 0:1], cpu.at(i))
306 assert np.array_equal(x[0:0, 0:1], gpu.at(i))
307
308
309def test_range_truncation():

Callers

nothing calls this directly

Calls 3

index_pipeFunction · 0.85
runMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected