holoscan::TensorOutputLoan
Hold sole unpublished authority for one plan-owned tensor output allocation.
The loan is move-constructible but neither copyable nor assignable. It exposes bounded metadata and an explicit host or CUDA write phase; it never converts to an owning Tensor or DLPack handle. Destruction abandons an unpublished live loan. Every terminal tensor publication or cancellation attempt consumes the loan, including an error result.
Constructors
TensorOutputLoan
Move
Overload 3
Copy (deleted)
Transfer unpublished authority from another loan.
Parameters
Loan whose authority becomes moved-from.
Destructor
~TensorOutputLoan
Abandon an unpublished live allocation without throwing.
Assignment operators
operator=
Deleted overloads
The following overloads are deleted to prevent misuse:
Methods
shape
Return the allocation shape.
Returns: Borrowed shape view valid while this loan remains live.
byte_strides
Return the allocation byte strides.
Returns: Borrowed explicit strides, or the empty/implicit-stride representation.
dtype
Return the allocation element type.
Returns: DLPack element type frozen at allocation.
device_id
Return the resolved CUDA device identity.
Returns: Device identity, or an invalid value for host-only/unresolved storage.
memory_kind
Return the concrete storage classification.
Returns: Memory kind frozen by the compiled allocation plan.
byte_size
Return the bounded allocation byte span.
Returns: Number of accessible bytes, including any explicit stride span.
write
Begin a CUDA-stream-ordered write phase.
This operation borrows the loan; the returned guard must be committed or destroyed before the loan is otherwise used.
Returns: A sole write guard, or a typed state/capability error.
Parameters
Stream on which producer writes will be ordered.
write_and_commit
Run one CUDA fill callback and commit its write phase.
A callback error abandons the active write and makes this loan nonpublishable. The callback must not retain the borrowed guard or its data pointer beyond the invocation.
Returns: Success after callback and commit, or the exact acquisition, callback, or commit error.
Throws: Any exception propagated by fill; the active write is abandoned during unwinding.
Template parameters
Callable accepting const TensorOutputWriteGuard& and returning either void or expected<void, Error>.
Parameters
Stream on which producer writes will be ordered.
Callback invoked exactly once after acquiring write authority.
write_host
Begin a host write phase.
Host write is admitted only for host-accessible placement frozen by the plan.
Returns: A sole write guard, or a typed state/capability error.
write_host_and_commit
Run one host fill callback and commit its write phase.
A callback error abandons the active write and makes this loan nonpublishable. The callback must not retain the borrowed guard or its data pointer beyond the invocation.
Returns: Success after callback and commit, or the exact acquisition, callback, or commit error.
Throws: Any exception propagated by fill; the active write is abandoned during unwinding.
Template parameters
Callable accepting const TensorOutputWriteGuard& and returning either void or expected<void, Error>.
Parameters
Callback invoked exactly once after acquiring host write authority.
cancel
Cancel unpublished tensor authority.
The terminal attempt consumes this loan for both success and failure. If a write guard is active, the allocation remains unavailable and tombstoned until that guard commits or is destroyed; the guard cannot publish and its commit returns kInvalidArgument.
Returns: Success when bounded retirement begins, or an error for invalid authority.