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

Function _test_callback

dali/test/python/test_external_source_dali.py:79–95  ·  view source on GitHub ↗
(device, as_tensors, change_layout_to=None)

Source from the content-addressed store, hash-verified

77
78
79def _test_callback(device, as_tensors, change_layout_to=None):
80 src_pipe, batch_size = build_src_pipe(device)
81 ref_pipe, batch_size = build_src_pipe(device, layout=change_layout_to)
82
83 dst_pipe = Pipeline(batch_size, 1, 0)
84
85 def get_from_src():
86 tl = src_pipe.run()[0]
87 return [tl[i] for i in range(len(tl))] if as_tensors else tl
88
89 outs = fn.external_source(source=get_from_src, device=device, layout=change_layout_to)
90 dst_pipe.set_outputs(outs)
91
92 for iter in range(3):
93 ref = ref_pipe.run()
94 out = dst_pipe.run()
95 check_batch(out[0], ref[0], batch_size, 0, 0)
96
97
98def test_callback():

Callers

nothing calls this directly

Calls 6

set_outputsMethod · 0.95
runMethod · 0.95
PipelineClass · 0.90
check_batchFunction · 0.90
build_src_pipeFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected