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

Method CreateFromReqs

python/mod_cvcuda/nvcv/Array.cpp:33–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31namespace nvcvpy::priv {
32
33std::shared_ptr<Array> Array::CreateFromReqs(const nvcv::Array::Requirements &reqs)
34{
35 std::vector<std::shared_ptr<CacheItem>> vcont = Cache::Instance().fetch(Key{reqs});
36
37 // None found?
38 if (vcont.empty())
39 {
40 std::shared_ptr<Array> array(new Array(reqs));
41 array->impl().resize(reqs.capacity);
42 Cache::Instance().add(*array);
43 return array;
44 }
45 else
46 {
47 // Get the first one
48 auto array = std::static_pointer_cast<Array>(vcont[0]);
49 NVCV_ASSERT(array->dtype() == reqs.dtype);
50 return array;
51 }
52}
53
54std::shared_ptr<Array> Array::Create(int64_t length, nvcv::DataType dtype)
55{

Callers

nothing calls this directly

Calls 6

implMethod · 0.80
fetchMethod · 0.45
emptyMethod · 0.45
resizeMethod · 0.45
addMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected