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

Function test_optional_build

dali/test/python/test_pipeline.py:2405–2434  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2403
2404
2405def test_optional_build():
2406 bs = 8
2407
2408 @pipeline_def(batch_size=bs, num_threads=4, device_id=0)
2409 def pdef_regular():
2410 enc, _ = fn.readers.file(file_root=jpeg_folder, name="only_reader")
2411 img = fn.decoders.image(enc, device="mixed")
2412 return img
2413
2414 @pipeline_def(batch_size=bs, num_threads=4, device_id=0)
2415 def pdef_source():
2416 source = fn.external_source(name="source")
2417 return source
2418
2419 pipes = [pdef_regular() for _ in range(5)]
2420 pipes.append(pdef_source())
2421
2422 for pipe in pipes:
2423 pipe.build()
2424
2425 (res,) = pipes[0].run()
2426 assert len(res.shape()) == 8
2427 pipes[1].schedule_run()
2428 (res_2,) = pipes[1].outputs()
2429 assert len(res_2.shape()) == 8
2430 assert pipes[2].epoch_size("only_reader") != 0
2431 assert pipes[3].executor_statistics() == {}
2432 assert "shard_id" in pipes[4].reader_meta("only_reader")
2433
2434 pipes[-1].feed_input("source", np.array([10, 10]))
2435
2436
2437def test_output_descs():

Callers

nothing calls this directly

Calls 12

pdef_regularFunction · 0.85
pdef_sourceFunction · 0.85
executor_statisticsMethod · 0.80
reader_metaMethod · 0.80
appendMethod · 0.45
buildMethod · 0.45
runMethod · 0.45
shapeMethod · 0.45
schedule_runMethod · 0.45
outputsMethod · 0.45
epoch_sizeMethod · 0.45
feed_inputMethod · 0.45

Tested by

no test coverage detected