Function TVMFFITensorCreateUnsafeView

Function TVMFFITensorCreateUnsafeView#

Function Documentation#

int TVMFFITensorCreateUnsafeView(TVMFFIObjectHandle source, const DLTensor *prototype, TVMFFIObjectHandle *out)#

Create a Tensor view from source using metadata in the prototype while retaining the source tensor.

Note

This function is unsafe and the caller must ensure the prototype is valid and that the prototype’s data pointer points to memory owned by the source tensor. The callee allocates shape and strides arrays in the output tensor and copies them from the prototype.

Parameters:
  • source – The source tensor whose data memory will be shared by the view.

  • prototype – The prototype DLTensor that contains the metadata for the view.

  • out – The output Tensor handle.

Returns:

0 on success, nonzero on failure.