| 948 | |
| 949 | |
| 950 | def 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 | |
| 972 | def test_no_slice(): |