Skip to navigation

holoscan::DLManagedTensorContext

Beta
View as Markdown

Context object holding a versioned DLPack tensor and a reference to its backing memory.

The Tensor class wraps this struct. The wrapped tensor is a DLManagedTensorVersioned so the Tensor can carry DLPack version and flags (e.g. read-only / copied). memory_reference keeps the data alive for as long as the context exists; it typically holds a DLManagedMemoryBuffer / DLManagedMemoryBufferVersioned whose destructor invokes the source tensor’s DLPack deleter, or a Holoscan-owned stream-aware reference. dl_shape / dl_strides own the shape/stride arrays the wrapped DLTensor points at. A private control block makes authority and transient read-lease state common to every Tensor wrapper over this context.

Vendored from nvidia::gxf::DLManagedTensorContext to remove the GXF dependency.

#include <holoscan/dlpack.hpp>

Constructors

DLManagedTensorContext

HOLOSCAN_CORE_EXPORT holoscan::DLManagedTensorContext::DLManagedTensorContext()

Create a context with a private local-writable access-authority control block.


Member variables

NameTypeDescription
tensorDLManagedTensorVersionedThe versioned tensor to wrap.
memory_referencestd::shared_ptr< TensorMemoryReference >Native Holoscan lifetime/stream hook keeping the backing memory alive.
dl_shapestd::vector< int64_t >Shape of the DLTensor (owned).
dl_stridesstd::vector< int64_t >Strides of the DLTensor in elements (owned).
access_state_std::shared_ptr< detail::TensorAccessState >