Function TVMFFIEnvSetTensorAllocator

Function TVMFFIEnvSetTensorAllocator#

Function Documentation#

int TVMFFIEnvSetTensorAllocator(DLPackTensorAllocator allocator, int write_to_global_context, DLPackTensorAllocator *opt_out_original_allocator)#

FFI function to set the current DLPack allocator in thread-local(TLS) context.

Parameters:
  • allocator – The allocator to set.

  • write_to_global_context – Whether to also set the allocator to the global context.

  • opt_out_original_allocator – Output original TLS allocator if the address is not nullptr.

Returns:

0 when success, nonzero when failure happens