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

Function test_range_truncation

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

Source from the content-addressed store, hash-verified

307
308
309def test_range_truncation():
310 data = [np.arange(10), np.arange(100)]
311 src = fn.external_source(lambda: data)
312 pipe = index_pipe(src, lambda x: x[50:150])
313 inp, cpu, gpu = tuple(out.as_cpu() for out in pipe.run())
314 for i in range(len(inp)):
315 x = inp.at(i)
316 cpu_sample = cpu.at(i)
317 gpu_sample = gpu.at(i)
318 ref_sample = x[50:150]
319 assert np.array_equal(cpu_sample, ref_sample), f"{cpu_sample} != {ref_sample}"
320 assert np.array_equal(gpu_sample, ref_sample), f"{cpu_sample} != {ref_sample}"
321
322
323def test_reverse_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