CreateTensorWithDataAsOrtValue property

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

\brief Create a tensor backed by a user supplied buffer

Create a tensor with user's buffer. You can fill the buffer either before calling this function or after. p_data is owned by caller. ReleaseValue won't release p_data.

If you wish to transfer ownership of p_data to ORT use CreateTensorWithDataAndDeleterAsOrtValue.

\paramin info Memory description of where the p_data buffer resides (CPU vs GPU etc). \paramin p_data Pointer to the data buffer. \paramin p_data_len The number of bytes in the data buffer. \paramin shape Pointer to the tensor shape dimensions. \paramin shape_len The number of tensor shape dimensions. \paramin type The data type. \paramout out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue

\snippet{doc} snippets.dox OrtStatus Return Value

Implementation

external ffi.Pointer<
  ffi.NativeFunction<
    OrtStatusPtr Function(
      ffi.Pointer<OrtMemoryInfo> info,
      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,
    )
  >
>
CreateTensorWithDataAsOrtValue;