()
| 54 | |
| 55 | |
| 56 | def test_tensorbatch_one_tensor(): |
| 57 | batch = cvcuda.TensorBatch(15) |
| 58 | |
| 59 | tensor = cvcuda.as_tensor(cvcuda.Image((64, 32), cvcuda.Format.RGBA8)) |
| 60 | batch.pushback(tensor) |
| 61 | assert len(batch) == 1 |
| 62 | assert batch.layout == "NHWC" |
| 63 | assert batch.dtype == np.uint8 |
| 64 | assert batch.ndim == 4 |
| 65 | assert list(batch) == [tensor] |
| 66 | |
| 67 | # range must contain one |
| 68 | cnt = 0 |
| 69 | for elem in batch: |
| 70 | assert elem is tensor |
| 71 | cnt += 1 |
| 72 | assert cnt == 1 |
| 73 | |
| 74 | # remove added tensor |
| 75 | batch.popback() |
| 76 | |
| 77 | # check if its indeed removed |
| 78 | assert len(batch) == 0 |
| 79 | assert list(batch) == [] |
| 80 | |
| 81 | |
| 82 | def test_tensorbatch_change_layout(): |
nothing calls this directly
no test coverage detected