()
| 307 | |
| 308 | |
| 309 | def test_range_truncation(): |
| 310 | data = [np.arange(10), np.arange(100)] |
| 311 | src = fn.external_source(lambda: data) |
| 312 | pipe = index_pipe(src, lambda x: x[50:150]) |
| 313 | inp, cpu, gpu = tuple(out.as_cpu() for out in pipe.run()) |
| 314 | for i in range(len(inp)): |
| 315 | x = inp.at(i) |
| 316 | cpu_sample = cpu.at(i) |
| 317 | gpu_sample = gpu.at(i) |
| 318 | ref_sample = x[50:150] |
| 319 | assert np.array_equal(cpu_sample, ref_sample), f"{cpu_sample} != {ref_sample}" |
| 320 | assert np.array_equal(gpu_sample, ref_sample), f"{cpu_sample} != {ref_sample}" |
| 321 | |
| 322 | |
| 323 | def test_reverse_range_truncation(): |
nothing calls this directly
no test coverage detected