CreateTensorWithDataAndDeleterAsOrtValue property

Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtAllocator> deleter, Pointer<Void> p_data, Size p_data_len, Pointer<Int64> shape, Size shape_len, UnsignedInt type, Pointer<Pointer<OrtValue>> out)>> CreateTensorWithDataAndDeleterAsOrtValue
getter/setter pair

\brief Create an OrtValue for a Tensor that uses pre-existing memory.

ORT will take ownership of the memory and free it using the provided deleter when no longer in use.

\paramin deleter OrtAllocator instance that will be used to free the memory. Only the OrtAllocator:Info and OrtAllocator::Release functions are required. The OrtMemoryInfo returned by OrtAllocator::Info must match the location of p_data. \paramin p_data Pointer to the memory that will be used by the Tensor. ORT will take ownership of the memory. \paramin p_data_len Length of the memory in bytes. \paramin shape Dimensions of the Tensor. All values should be > 0. \paramin shape_len Number of dimensions in the shape array. \paramin type Data type of the Tensor. \paramout out Newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue

\snippet{doc} snippets.dox OrtStatus Return Value

\since Version 1.22.

Implementation

external ffi.Pointer<
  ffi.NativeFunction<
    OrtStatusPtr Function(
      ffi.Pointer<OrtAllocator> deleter,
      ffi.Pointer<ffi.Void> p_data,
      ffi.Size p_data_len,
      ffi.Pointer<ffi.Int64> shape,
      ffi.Size shape_len,
      ffi.UnsignedInt type,
      ffi.Pointer<ffi.Pointer<OrtValue>> out,
    )
  >
>
CreateTensorWithDataAndDeleterAsOrtValue;