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

Function check_no_slice

dali/test/python/operator_1/test_slice.py:950–969  ·  view source on GitHub ↗
(device, dtype, batch_size, num_threads)

Source from the content-addressed store, hash-verified

948
949
950def check_no_slice(device, dtype, batch_size, num_threads):
951 @pipeline_def(batch_size=batch_size, num_threads=num_threads, device_id=0)
952 def make_pipe():
953 encoded, _ = fn.readers.caffe(path=caffe_db_folder, random_shuffle=False)
954 image = fn.decoders.image(encoded, device="cpu", output_type=types.RGB)
955 if device == "gpu":
956 image = image.gpu()
957 image = fn.cast(image, dtype=dtype)
958 sliced1 = fn.slice(image, 0, 3, axes=(2,))
959 sliced2 = fn.slice(image, rel_start=(0, 0, 0), rel_end=(1, 1, 1), axis_names="HWC")
960 return image, sliced1, sliced2
961
962 pipe = make_pipe()
963 for _ in range(3):
964 outs = pipe.run()
965 nouts = len(outs)
966 in_img = as_array(outs[0][0])
967 for out_idx in range(1, nouts):
968 out_img = as_array(outs[out_idx][0])
969 np.testing.assert_array_equal(in_img, out_img)
970
971
972def test_no_slice():

Callers

nothing calls this directly

Calls 3

as_arrayFunction · 0.90
make_pipeFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected