(device, as_tensors, change_layout_to=None)
| 77 | |
| 78 | |
| 79 | def _test_callback(device, as_tensors, change_layout_to=None): |
| 80 | src_pipe, batch_size = build_src_pipe(device) |
| 81 | ref_pipe, batch_size = build_src_pipe(device, layout=change_layout_to) |
| 82 | |
| 83 | dst_pipe = Pipeline(batch_size, 1, 0) |
| 84 | |
| 85 | def get_from_src(): |
| 86 | tl = src_pipe.run()[0] |
| 87 | return [tl[i] for i in range(len(tl))] if as_tensors else tl |
| 88 | |
| 89 | outs = fn.external_source(source=get_from_src, device=device, layout=change_layout_to) |
| 90 | dst_pipe.set_outputs(outs) |
| 91 | |
| 92 | for iter in range(3): |
| 93 | ref = ref_pipe.run() |
| 94 | out = dst_pipe.run() |
| 95 | check_batch(out[0], ref[0], batch_size, 0, 0) |
| 96 | |
| 97 | |
| 98 | def test_callback(): |
nothing calls this directly
no test coverage detected