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

Function test_remap

dali/test/python/test_dali_variable_batch_size.py:846–872  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

844
845
846def test_remap():
847 def pipe(max_batch_size, input_data, device):
848 pipe = Pipeline(batch_size=max_batch_size, device_id=0, num_threads=4)
849 with pipe:
850 input, mapx, mapy = fn.external_source(device=device, source=input_data, num_outputs=3)
851 out = fn.experimental.remap(input, mapx, mapy)
852 pipe.set_outputs(out)
853 return pipe
854
855 def get_data(batch_size):
856 input_shape = [480, 640, 3]
857 mapx_shape = mapy_shape = [480, 640]
858 input = [
859 np.random.randint(0, 255, size=input_shape, dtype=np.uint8) for _ in range(batch_size)
860 ]
861 mapx = [
862 640 * np.random.random(size=mapx_shape).astype(np.float32) # [0, 640) interval
863 for _ in range(batch_size)
864 ]
865 mapy = [
866 480 * np.random.random(size=mapy_shape).astype(np.float32) # [0, 480) interval
867 for _ in range(batch_size)
868 ]
869 return input, mapx, mapy
870
871 input_data = [get_data(random.randint(5, 31)) for _ in range(13)]
872 check_pipeline(input_data, pipeline_fn=pipe, devices=["gpu"])
873
874
875def test_random_bbox_crop_op():

Callers

nothing calls this directly

Calls 2

check_pipelineFunction · 0.85
get_dataFunction · 0.70

Tested by

no test coverage detected