()
| 108 | |
| 109 | |
| 110 | def test_tuples(): |
| 111 | @pipeline_def(enable_conditionals=True, num_threads=4, batch_size=8, device_id=0) |
| 112 | def pipeline(): |
| 113 | pred = fn.external_source(source=lambda x: np.array(x.idx_in_batch % 2), batch=False) |
| 114 | data = types.Constant(np.array(42), device="cpu") |
| 115 | if pred: |
| 116 | out = (data, data + 10, data + 20) |
| 117 | else: |
| 118 | out = (np.array(-10), data, data * 2) |
| 119 | a, b, c = out |
| 120 | return a, b, c |
| 121 | |
| 122 | pipe = pipeline() |
| 123 | ( |
| 124 | a, |
| 125 | b, |
| 126 | c, |
| 127 | ) = pipe.run() |
| 128 | check_batch(a, [42 if i % 2 else -10 for i in range(8)]) |
| 129 | check_batch(b, [52 if i % 2 else 42 for i in range(8)]) |
| 130 | check_batch(c, [62 if i % 2 else 84 for i in range(8)]) |
| 131 | |
| 132 | |
| 133 | def test_nesting_error(): |
nothing calls this directly
no test coverage detected