Function Snpe_Util_CreateUserBufferShared

Function Documentation

Snpe_IUserBuffer_Handle_t Snpe_Util_CreateUserBufferShared(void *buffer, size_t bufSize, uint64_t addrOffset, Snpe_TensorShape_Handle_t stridesHandle, Snpe_IUserBuffer_Handle_t userBufferEncodingHandle)

Creates a UserBuffer.

Parameters
  • buffer[in] Pointer to the buffer that the caller supplies

  • bufSize[in] Buffer size, in bytes

  • addrOffset[in] byte offset to the actual address from the start of the allocated buffer. This is useful for sharing a large buffer amongst different tensors. When set to 0 this API behaves like Snpe_Util_CreateUserBuffer()

  • stridesHandle[in] Total number of bytes between elements in each dimension. E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4].

  • userBufferEncodingHandle[in] Handle to a UserBufferEncoding object

Returns

Handle to the created UserBuffer

Note

Caller has to ensure that memory pointed to by buffer stays accessible for the lifetime of the object created