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

Function _test_std_dev_large_data

dali/test/python/operator_2/test_reduce.py:653–671  ·  view source on GitHub ↗
(rank, axes, device, in_layout)

Source from the content-addressed store, hash-verified

651
652@nottest
653def _test_std_dev_large_data(rank, axes, device, in_layout):
654 batch_size = 16
655 num_batches = 2
656 data = fast_large_random_batches(rank, batch_size, num_batches)
657
658 pipe = Pipeline(batch_size=batch_size, num_threads=4, device_id=0 if device == "gpu" else None)
659 input = fn.external_source(data, cycle=True, device=device, layout=in_layout)
660 mean = fn.reductions.mean(input, axes=axes)
661 reduced = fn.reductions.std_dev(input, mean, axes=axes, ddof=0)
662 pipe.set_outputs(reduced)
663
664 for b, batch in enumerate(data):
665 (out,) = pipe.run()
666 check_layout(out, in_layout, axes, False)
667 if device == "gpu":
668 out = out.as_cpu()
669 for i in range(batch_size):
670 ref = np.std(batch[i].astype(np.float64), axis=axes, ddof=0)
671 assert np.allclose(out[i], ref, 1e-5, 1e-5)
672
673
674def test_std_dev_large_data():

Callers

nothing calls this directly

Calls 5

set_outputsMethod · 0.95
runMethod · 0.95
PipelineClass · 0.90
check_layoutFunction · 0.70

Tested by

no test coverage detected