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

Method Create

python/mod_cvcuda/nvcv/ExternalBuffer.cpp:55–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55py::object ExternalBuffer::Create(DLPackTensor &&dlPackTensor, py::object wrappedObj)
56{
57 std::shared_ptr<ExternalBuffer> buf(new ExternalBuffer(std::move(dlPackTensor)));
58
59 // We must make the returned object keep wrappedObj alive.
60 // Using py::return_value_policy::reference_internal in py::cast doesn't work
61 // because buf is a shared_ptr.
62 py::object o = py::cast(buf);
63 py::detail::keep_alive_impl(o, wrappedObj);
64
65 // If we expose cuda array interface,
66 if (auto iface = buf->cudaArrayInterface())
67 {
68 o.attr("__cuda_array_interface__") = *iface;
69 }
70
71 return o;
72}
73
74ExternalBuffer::ExternalBuffer(DLPackTensor &&dlTensor)
75{

Callers

nothing calls this directly

Calls 2

castFunction · 0.85
cudaArrayInterfaceMethod · 0.80

Tested by

no test coverage detected