Function TVMFFIEnvTensorAlloc

Function TVMFFIEnvTensorAlloc#

Function Documentation#

int TVMFFIEnvTensorAlloc(DLTensor *prototype, TVMFFIObjectHandle *out)#

Allocate a tensor from the allocator set in thread-local(TLS) context.

This function redirects to one of environment allocator. As of now, we only support the DLPackManagedTensorAllocator set in thread-local(TLS) context.

Parameters:
  • prototype – The prototype DLTensor, only the dtype, ndim, shape, and device fields are used, other fields are ignored.

  • out – The output tensor in kTVMFFITensor type.

Returns:

0 when success, nonzero when failure happens