()
| 2403 | |
| 2404 | |
| 2405 | def test_optional_build(): |
| 2406 | bs = 8 |
| 2407 | |
| 2408 | @pipeline_def(batch_size=bs, num_threads=4, device_id=0) |
| 2409 | def pdef_regular(): |
| 2410 | enc, _ = fn.readers.file(file_root=jpeg_folder, name="only_reader") |
| 2411 | img = fn.decoders.image(enc, device="mixed") |
| 2412 | return img |
| 2413 | |
| 2414 | @pipeline_def(batch_size=bs, num_threads=4, device_id=0) |
| 2415 | def pdef_source(): |
| 2416 | source = fn.external_source(name="source") |
| 2417 | return source |
| 2418 | |
| 2419 | pipes = [pdef_regular() for _ in range(5)] |
| 2420 | pipes.append(pdef_source()) |
| 2421 | |
| 2422 | for pipe in pipes: |
| 2423 | pipe.build() |
| 2424 | |
| 2425 | (res,) = pipes[0].run() |
| 2426 | assert len(res.shape()) == 8 |
| 2427 | pipes[1].schedule_run() |
| 2428 | (res_2,) = pipes[1].outputs() |
| 2429 | assert len(res_2.shape()) == 8 |
| 2430 | assert pipes[2].epoch_size("only_reader") != 0 |
| 2431 | assert pipes[3].executor_statistics() == {} |
| 2432 | assert "shard_id" in pipes[4].reader_meta("only_reader") |
| 2433 | |
| 2434 | pipes[-1].feed_input("source", np.array([10, 10])) |
| 2435 | |
| 2436 | |
| 2437 | def test_output_descs(): |
nothing calls this directly
no test coverage detected