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

Function main

samples/datatypes/tensorbatch.py:23–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22
23def main() -> None:
24 # TensorBatch - all tensors must have same rank, dtype, and layout
25 batch = cvcuda.TensorBatch(capacity=10)
26 tensor1 = cvcuda.Tensor((100, 100, 3), np.uint8, "HWC")
27 tensor2 = cvcuda.Tensor((150, 200, 3), np.uint8, "HWC")
28 tensor3 = cvcuda.Tensor((200, 150, 3), np.uint8, "HWC")
29 batch.pushback([tensor1, tensor2, tensor3])
30
31 # Different datatypes (each batch needs same dtype)
32 batch_float = cvcuda.TensorBatch(capacity=5)
33 t_float1 = cvcuda.Tensor((100, 100, 3), np.float32, "HWC")
34 t_float2 = cvcuda.Tensor((120, 80, 3), np.float32, "HWC")
35 batch_float.pushback([t_float1, t_float2])
36
37 batch_int16 = cvcuda.TensorBatch(capacity=5)
38 t_int1 = cvcuda.Tensor((50, 50, 1), np.int16, "HWC")
39 batch_int16.pushback([t_int1])
40
41
42# docs-end: main

Callers 1

tensorbatch.pyFile · 0.70

Calls 2

TensorBatchMethod · 0.45
TensorMethod · 0.45

Tested by

no test coverage detected