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

Method CreateFromReqs

python/mod_cvcuda/nvcv/Tensor.cpp:69–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69std::shared_ptr<Tensor> Tensor::CreateFromReqs(const nvcv::Tensor::Requirements &reqs)
70{
71 std::vector<std::shared_ptr<CacheItem>> vcont = Cache::Instance().fetch(Key{reqs});
72
73 // None found?
74 if (vcont.empty())
75 {
76 std::shared_ptr<Tensor> tensor(new Tensor(reqs));
77 Cache::Instance().add(*tensor);
78 return tensor;
79 }
80 else
81 {
82 // Get the first one
83 auto tensor = std::static_pointer_cast<Tensor>(vcont[0]);
84 NVCV_ASSERT(tensor->dtype() == reqs.dtype);
85 return tensor;
86 }
87}
88
89namespace {
90

Callers

nothing calls this directly

Calls 4

fetchMethod · 0.45
emptyMethod · 0.45
addMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected