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

Function test_source_info

dali/test/python/decoder/test_video.py:346–380  ·  view source on GitHub ↗
(device)

Source from the content-addressed store, hash-verified

344
345@params("cpu", "gpu")
346def test_source_info(device):
347 skip_if_m60()
348 filenames = glob.glob(f"{get_dali_extra_path()}/db/video/[cv]fr/*.mp4")
349 # filter out HEVC because some GPUs do not support it
350 filenames = filter(lambda filename: "hevc" not in filename, filenames)
351 # filter out AV1 because some GPUs do not support it
352 filenames = filter(lambda filename: "av1" not in filename, filenames)
353 if device == "cpu":
354 # some formats are not yet supported in the CPU operator itself
355 filenames = filter(lambda filename: "mpeg4" not in filename, filenames)
356 excluded = {"test_1.mp4", "test_2.mp4"}
357 filenames = filter(lambda f: os.path.basename(f) not in excluded, filenames)
358
359 files = list(filenames)
360
361 @pipeline_def
362 def test_pipeline():
363 videos = fn.experimental.readers.video(
364 device=device,
365 filenames=files,
366 sequence_length=1,
367 step=10000000, # make sure that each video has only one valid sequence
368 )
369 return videos
370
371 batch_size = 4
372 device_id = None if device == "cpu" else 0
373 p = test_pipeline(batch_size=batch_size, num_threads=1, device_id=device_id)
374
375 samples_read = 0
376 while samples_read < len(files):
377 o = p.run()
378 for idx, t in enumerate(o[0]):
379 assert t.source_info() == files[(samples_read + idx) % len(files)]
380 samples_read += batch_size
381
382
383@params("cpu", "mixed")

Callers

nothing calls this directly

Calls 6

skip_if_m60Function · 0.90
get_dali_extra_pathFunction · 0.90
filterClass · 0.85
source_infoMethod · 0.80
test_pipelineFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected