MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / test_tensorbatch_one_tensor

Function test_tensorbatch_one_tensor

tests/cvcuda/python/test_tensor_batch.py:56–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55
56def 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
82def test_tensorbatch_change_layout():

Callers

nothing calls this directly

Calls 2

TensorBatchMethod · 0.45
ImageMethod · 0.45

Tested by

no test coverage detected