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

Function test_output_layout

dali/test/python/operator_2/test_python_function.py:568–589  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

566
567
568def test_output_layout():
569 pipe = CommonPipeline(1, 1, 0, 999, images_dir)
570 with pipe:
571 images, _ = pipe.load()
572 out1, out2 = fn.python_function(
573 images, function=lambda x: (x, x.mean(2)), num_outputs=2, output_layouts=["ABC", "DE"]
574 )
575 out3, out4 = fn.python_function(
576 images, function=lambda x: (x, x / 2), num_outputs=2, output_layouts="FGH"
577 )
578 out5, out6 = fn.python_function(
579 images, function=lambda x: (x, x / 2), num_outputs=2, output_layouts=["IJK"]
580 )
581
582 pipe.set_outputs(out1, out2, out3, out4, out5, out6)
583 out1, out2, out3, out4, out5, out6 = pipe.run()
584 assert out1.layout() == "ABC"
585 assert out2.layout() == "DE"
586 assert out3.layout() == "FGH"
587 assert out4.layout() == "FGH"
588 assert out5.layout() == "IJK"
589 assert out6.layout() == ""
590
591
592@raises(RuntimeError, "*length of*output_layouts*greater than*")

Callers

nothing calls this directly

Calls 5

loadMethod · 0.95
set_outputsMethod · 0.80
CommonPipelineClass · 0.70
runMethod · 0.45
layoutMethod · 0.45

Tested by

no test coverage detected