()
| 1444 | @has_operator("decoders.inflate") |
| 1445 | @restrict_platform(min_compute_cap=6.0) |
| 1446 | def test_inflate(): |
| 1447 | import lz4.block |
| 1448 | |
| 1449 | def sample_to_lz4(sample): |
| 1450 | deflated_buf = lz4.block.compress(sample, store_size=False) |
| 1451 | return np.frombuffer(deflated_buf, dtype=np.uint8) |
| 1452 | |
| 1453 | def inflate_pipline(max_batch_size, inputs, device): |
| 1454 | input_data = [[sample_to_lz4(sample) for sample in batch] for batch in inputs] |
| 1455 | input_shape = [ |
| 1456 | [np.array(sample.shape, dtype=np.int32) for sample in batch] for batch in inputs |
| 1457 | ] |
| 1458 | |
| 1459 | @pipeline_def |
| 1460 | def piepline(): |
| 1461 | defalted = fn.external_source(source=input_data) |
| 1462 | shape = fn.external_source(source=input_shape) |
| 1463 | return fn.decoders.inflate(defalted.gpu(), shape=shape) |
| 1464 | |
| 1465 | return piepline(batch_size=max_batch_size, num_threads=4, device_id=0) |
| 1466 | |
| 1467 | def sample_gen(): |
| 1468 | j = 42 |
| 1469 | while True: |
| 1470 | yield np.full((13, 7), j) |
| 1471 | j += 1 |
| 1472 | |
| 1473 | sample = sample_gen() |
| 1474 | batches = [ |
| 1475 | [next(sample) for _ in range(5)], |
| 1476 | [next(sample) for _ in range(13)], |
| 1477 | [next(sample) for _ in range(2)], |
| 1478 | ] |
| 1479 | |
| 1480 | check_pipeline(batches, inflate_pipline, devices=["gpu"]) |
| 1481 | |
| 1482 | |
| 1483 | @params(fn.experimental.debayer, fn.debayer) |
nothing calls this directly
no test coverage detected