()
| 80 | |
| 81 | |
| 82 | def test_tensorbatch_change_layout(): |
| 83 | batch = cvcuda.TensorBatch(10) |
| 84 | tensorsA = random_tensors(5, np.float32, 3, "HWC") |
| 85 | batch.pushback(tensorsA) |
| 86 | assert list(batch) == tensorsA |
| 87 | assert batch.layout == "HWC" |
| 88 | assert batch.dtype == np.float32 |
| 89 | assert batch.ndim == 3 |
| 90 | |
| 91 | batch.popback(len(tensorsA)) |
| 92 | assert list(batch) == [] |
| 93 | assert batch.layout is None |
| 94 | assert batch.dtype is None |
| 95 | assert batch.ndim == -1 |
| 96 | |
| 97 | tensorsB = [ |
| 98 | cvcuda.as_tensor(cvcuda.Image(rand_shape(2), cvcuda.Format.RGBA8)) |
| 99 | for _ in range(7) |
| 100 | ] |
| 101 | batch.pushback(tensorsB) |
| 102 | assert list(batch) == tensorsB |
| 103 | assert batch.layout == "NHWC" |
| 104 | assert batch.dtype == np.uint8 |
| 105 | assert batch.ndim == 4 |
| 106 | |
| 107 | batch.clear() |
| 108 | assert list(batch) == [] |
| 109 | assert batch.layout is None |
| 110 | assert batch.dtype is None |
| 111 | assert batch.ndim == -1 |
| 112 | |
| 113 | |
| 114 | def test_tensorbatch_multiply_tensors(): |
nothing calls this directly
no test coverage detected