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

Class TensorBatch

python/mod_cvcuda/include/nvcv/python/TensorBatch.hpp:34–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace py = pybind11;
33
34class TensorBatch
35 : public Resource
36 , public nvcv::TensorBatch
37{
38public:
39 static TensorBatch Create(int capacity)
40 {
41 PyObject *tensorBatch = capi().TensorBatch_Create(capacity);
42 CheckCAPIError();
43 NVCV_ASSERT(tensorBatch != nullptr);
44 py::object pytensorBatch = py::reinterpret_steal<py::object>(tensorBatch);
45
46 return TensorBatch(pytensorBatch);
47 }
48
49 void pushBack(Tensor tensor)
50 {
51 capi().TensorBatch_PushBack(this->ptr(), tensor.ptr());
52 CheckCAPIError();
53 }
54
55 void popBack(int cnt)
56 {
57 capi().TensorBatch_PopBack(this->ptr(), cnt);
58 CheckCAPIError();
59 }
60
61 void clear()
62 {
63 capi().TensorBatch_Clear(this->ptr());
64 CheckCAPIError();
65 }
66
67 using nvcv::TensorBatch::operator[];
68 using nvcv::TensorBatch::begin;
69 using nvcv::TensorBatch::end;
70
71private:
72 friend struct py::detail::type_caster<TensorBatch>;
73
74 TensorBatch() = default;
75
76 explicit TensorBatch(py::object obj)
77 : Resource(obj)
78 , nvcv::TensorBatch(FromHandle(CheckCAPIError(capi().TensorBatch_GetHandle(this->ptr())), true))
79 {
80 }
81};
82
83} // namespace nvcvpy
84

Callers 2

CreateMethod · 0.70
loadMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected