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

Method Create

python/mod_cvcuda/nvcv/TensorBatch.cpp:42–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42std::shared_ptr<TensorBatch> TensorBatch::Create(int capacity)
43{
44 std::vector<std::shared_ptr<CacheItem>> vcont = Cache::Instance().fetch(Key{capacity});
45
46 // None found?
47 if (vcont.empty())
48 {
49 std::shared_ptr<TensorBatch> batch(new TensorBatch(capacity));
50 Cache::Instance().add(*batch);
51 return batch;
52 }
53 else
54 {
55 // Get the first one
56 auto batch = std::static_pointer_cast<TensorBatch>(vcont[0]);
57 batch->clear(); // make sure it's in pristine state
58 return batch;
59 }
60}
61
62std::shared_ptr<TensorBatch> TensorBatch::WrapExternalBufferVector(std::vector<py::object> buffers,
63 std::optional<nvcv::TensorLayout> layout)

Callers

nothing calls this directly

Calls 4

fetchMethod · 0.45
emptyMethod · 0.45
addMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected