DLManagedTensorVersioned#

struct DLManagedTensorVersioned#

A versioned and managed C Tensor object, manage memory of DLTensor.

This data structure is intended to facilitate the borrowing of DLTensor by another framework. It is not meant to transfer the tensor. When the borrowing framework doesn’t need the tensor, it should call the deleter to notify the host that the resource is no longer needed.

Note

This is the current standard DLPack exchange data structure.

Public Members

DLPackVersion version#

The API and ABI version of the current managed Tensor.

void *manager_ctx#

the context of the original host framework.

Stores DLManagedTensorVersioned is used in the framework. It can also be NULL.

void (*deleter)(struct DLManagedTensorVersioned *self)#

Destructor.

This should be called to destruct manager_ctx which holds the DLManagedTensorVersioned. It can be NULL if there is no way for the caller to provide a reasonable destructor. The destructor deletes the argument self as well.

uint64_t flags#

Additional bitmask flags information about the tensor.

By default the flags should be set to 0.

See also

DLPACK_FLAG_BITMASK_READ_ONLY

See also

DLPACK_FLAG_BITMASK_IS_COPIED

Note

Future ABI changes should keep everything until this field stable, to ensure that deleter can be correctly called.

DLTensor dl_tensor#

DLTensor which is being memory managed.