File PSNPE.h

Parent directory (SNPE)

Definition (SNPE/PSNPE.h)

Includes

Functions

Full File Listing

Typedefs

typedef void *Snpe_PSNPE_OutputAsyncCallbackParam_Handle_t

A typedef to indicate the callback PSNPE handle of Async Output mode

typedef void *Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t

A typedef to indicate the output callback of PSNPE handle of input-output async mode

typedef void *Snpe_PSNPE_InputOutputInputAsyncCallbackParam_Handle_t

A typedef to indicate the input callback of PSNPE handle of input-output async mode

typedef void *Snpe_BuildConfig_Handle_t

A typedef to indicate build configuration

typedef void *Snpe_PSNPE_Handle_t

A typedef to indicate a PSNPE object

Enums

enum Snpe_PSNPE_BuildMode_t

A typedef to indicate if PSNPE object is built in serial or parallel, default = 0

Values:

enumerator SNPE_PSNPE_BUILDMODE_SERIAL = 0
enumerator SNPE_PSNPE_BUILDMODE_PARALLEL = 1
enum Snpe_PSNPE_InputOutputTransmissionMode_t

A typedef to indicate if PSNPE objects are executed in sync mode or output async mode or input-output async mode, default = 0

Values:

enumerator SNPE_PSNPE_INPUTOUTPUTTRANSMISSIONMODE_SYNC = 0
enumerator SNPE_PSNPE_INPUTOUTPUTTRANSMISSIONMODE_OUTPUTASYNC = 1
enumerator SNPE_PSNPE_INPUTOUTPUTTRANSMISSIONMODE_INPUTOUTPUTASYNC = 2

Functions

size_t Snpe_PSNPE_OutputAsyncCallbackParam_GetDataIdx(Snpe_PSNPE_OutputAsyncCallbackParam_Handle_t oacpHandle)

Get the data index of an output async PSNPE object.

Parameters

oacpHandle[in] Handle to access the PSNPE object of output async mode

Returns

The data idx for output async mode

int Snpe_PSNPE_OutputAsyncCallbackParam_GetExecuteStatus(Snpe_PSNPE_OutputAsyncCallbackParam_Handle_t oacpHandle)

Execute an output async PSNPE object.

Parameters

oacpHandle[in] Handle to access the PSNPE object of output async mode

Returns

True if executed successfully with outputAsync mode

const char *Snpe_PSNPE_OutputAsyncCallbackParam_GetErrorMsg(Snpe_PSNPE_OutputAsyncCallbackParam_Handle_t oacpHandle)

Get the error message during the execution of PSNPE output async mode.

Parameters

oacpHandle[in] Handle to access the PSNPE object of output async mode

Returns

Error message

size_t Snpe_PSNPE_OutputAsyncCallbackParam_GetID(Snpe_PSNPE_OutputAsyncCallbackParam_Handle_t oacpHandle)

Get the ID of an output async PSNPE object.

Parameters

oacpHandle[in] Handle to access the PSNPE object of output async mode

Returns

The id of an PSNPE object for output async mode

size_t Snpe_PSNPE_InputOutputAsyncCallbackParam_GetDataIdx(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle)

Get the data index of an input-output async PSNPE object.

Parameters

oacpHandle[in] Handle to access the PSNPE object of input-output async mode

Returns

The data index for input-output async mode

int Snpe_PSNPE_InputOutputAsyncCallbackParam_GetExecuteStatus(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle)

Execute an input-output async PSNPE object.

Parameters

oacpHandle[in] Handle to access the PSNPE object of input-output async mode

Returns

True if executed successfully with input-output async mode

const char *Snpe_PSNPE_InputOutputAsyncCallbackParam_GetErrorMsg(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle)

Get the error message during the execution of PSNPE input-output async mode.

Parameters

oacpHandle[in] Handle to access the PSNPE object of input-output async mode

Returns

error message

Snpe_StringList_Handle_t Snpe_PSNPE_InputOutputAsyncCallbackParam_GetUserBufferNames(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle)

Get the names of output buffers to the network.

Parameters

ioacpHandle[in] Handle to access the PSNPE object of input-output async mode

Returns

Handle of output buffer name list

Snpe_ApplicationBufferMap_Handle_t Snpe_PSNPE_InputOutputAsyncCallbackParam_GetOutputMap_Ref(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle)

Get the output buffer map of PSNPE object for input-output async mode.

Parameters

ioacpHandle[in] Handle to access the PSNPE object of input-output async mode

Returns

The reference handle of output ApplicationBufferMap

size_t Snpe_PSNPE_InputOutputAsyncCallbackParam_GetID(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle)

Get the id of the output callback for input-output async mode.

Parameters

oacpHandle[in] Handle to access the PSNPE object of input-output async mode

Returns

The id for output callback for input-output async mode

Snpe_StringList_Handle_t Snpe_PSNPE_InputOutputInputAsyncCallbackParam_GetInputs(Snpe_PSNPE_InputOutputInputAsyncCallbackParam_Handle_t ioiacpHandle)

Get the input list for input callback of input-output async mode.

Parameters

ioacpHandle[in] Handle to access the object of input callback of input-output async mode

Returns

List the inputs

Snpe_StringList_Handle_t Snpe_PSNPE_InputOutputInputAsyncCallbackParam_GetInputNames(Snpe_PSNPE_InputOutputInputAsyncCallbackParam_Handle_t ioiacpHandle)

Get the input names for input callback of input-output async mode.

Parameters

ioacpHandle[in] Handle to access the object of input callback of input-output async mode

Returns

List the names of input

size_t Snpe_PSNPE_InputOutputInputAsyncCallbackParam_GetID(Snpe_PSNPE_InputOutputInputAsyncCallbackParam_Handle_t ioiacpHandle)

Get the id of the input callback for input-output async mode.

Parameters

oacpHandle[in] Handle to access the object of input-output async mode

Returns

The id of input callback for input-output async mode

Snpe_UserBufferData_t Snpe_PSNPE_InputOutputAsyncCallbackParam_GetUserBuffer(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t ioacpHandle, const char *name)

Get the output data of the output callback for input-output async mode.

Parameters
  • oacpHandle[in] Handle to access the object of output callback of input-output async mode

  • name[in] The output name of output callback of input-output async mode

Returns

The output data of output callback for input-output async mode

Snpe_BuildConfig_Handle_t Snpe_BuildConfig_Create()

Create the object of snpe build config.

Returns

the SNPE build handle

Snpe_ErrorCode_t Snpe_BuildConfig_Delete(Snpe_BuildConfig_Handle_t buildConfigHandle)

Release the object of snpe build config.

Parameters

buildConfigHandle[in] Handle to access the object of snpe build config

Returns

The error of build config result

Snpe_PSNPE_BuildMode_t Snpe_BuildConfig_GetBuildMode(Snpe_BuildConfig_Handle_t bcHandle)

Get the mode of build snpe object, serial or parallel.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The value of Snpe_PSNPE_BuildMode_t

Snpe_ErrorCode_t Snpe_BuildConfig_SetBuildMode(Snpe_BuildConfig_Handle_t bcHandle, Snpe_PSNPE_BuildMode_t buildMode)

Set the mode of build snpe object, serial or parallel.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • buildMode[in] A typedef of Snpe_PSNPE_BuildMode_t

Returns

The result of setting mode

Snpe_ErrorCode_t Snpe_BuildConfig_SetContainer(Snpe_BuildConfig_Handle_t bcHandle, Snpe_DlContainer_Handle_t dlcHandle)

Set the dlc model.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • dlcHandle[in] A handle of snpe DLC container

Returns

The result of setting dlc model

Snpe_DlContainer_Handle_t Snpe_BuildConfig_GetContainer_Ref(Snpe_BuildConfig_Handle_t bcHandle)

Get dlc container in snpe build config.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The reference handle of DLC container

Snpe_ErrorCode_t Snpe_BuildConfig_SetOutputBufferNames(Snpe_BuildConfig_Handle_t bcHandle, Snpe_StringList_Handle_t slHandle)

Set output buffer names in snpe build config.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • slHandle[in] A handle of the output layer name list

Returns

The result of setting output names

Snpe_StringList_Handle_t Snpe_BuildConfig_GetOutputBufferNames_Ref(Snpe_BuildConfig_Handle_t bcHandle)

Get output buffer names in snpe build config.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The reference handle of output buffer name list.

Snpe_ErrorCode_t Snpe_BuildConfig_SetOutputTensors(Snpe_BuildConfig_Handle_t bcHandle, Snpe_StringList_Handle_t slHandle)

Set output buffer names in snpe build config.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • slHandle[in] List of tensor names to output. An empty list will result in producing output for the final output tensor of the model. The list will be copied

Returns

The result of setting output tensors

Snpe_StringList_Handle_t Snpe_BuildConfig_GetOutputTensors_Ref(Snpe_BuildConfig_Handle_t bcHandle)

Get output tensors in snpe build config.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The reference handle of output tensor list

Snpe_ErrorCode_t Snpe_BuildConfig_SetRuntimeConfigList(Snpe_BuildConfig_Handle_t bcHandle, Snpe_RuntimeConfigList_Handle_t rclHandle)

Set runtime config list for snpe buildConfig.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • rclHandle[in] Handle to access the object of runtime config list

Returns

The result error message

Snpe_RuntimeConfigList_Handle_t Snpe_BuildConfig_GetRuntimeConfigList_Ref(Snpe_BuildConfig_Handle_t bcHandle)

Get runtime config list for snpe buildConfig.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The reference handle of runtime config list

size_t Snpe_BuildConfig_GetInputThreadNumbers(Snpe_BuildConfig_Handle_t bcHandle)

Get input thread number of input data for input-output async mode.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The number of input thread

Snpe_ErrorCode_t Snpe_BuildConfig_SetInputThreadNumbers(Snpe_BuildConfig_Handle_t bcHandle, size_t threadNumbers)

Set input thread number of input data for input-output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • threadNumbers[in] The number of input thread for input-output async mode

Returns

The result error message

size_t Snpe_BuildConfig_GetOutputThreadNumbers(Snpe_BuildConfig_Handle_t bcHandle)

Get output thread number of output data for input-output async mode.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The number of output thread

Snpe_ErrorCode_t Snpe_BuildConfig_SetOutputThreadNumbers(Snpe_BuildConfig_Handle_t bcHandle, size_t threadNumbers)

Set output thread number of output data for input-output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • threadNumbers[in] The number of output thread for input-output async mode

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetOutputCallback(Snpe_BuildConfig_Handle_t bcHandle, void (*callbackFunc)(Snpe_PSNPE_OutputAsyncCallbackParam_Handle_t))

Set output callback for output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • callbackFunc[in] The ouutput callback function for output async mode

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetOutputCallbackID(Snpe_BuildConfig_Handle_t bcHandle, size_t id)

Set the id of output callback function for output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • id[in] The id of output callback function

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_ClearOutputCallback(Snpe_BuildConfig_Handle_t bcHandle)

Set the inside output callback handle to NULL for output async mode.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetInputOutputCallback(Snpe_BuildConfig_Handle_t bcHandle, void (*callbackFunc)(Snpe_PSNPE_InputOutputAsyncCallbackParam_Handle_t))

Set output callback for input-output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • callbackFunc[in] The output callback function for input-output async mode

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetInputOutputCallbackID(Snpe_BuildConfig_Handle_t bcHandle, size_t id)

Set the id of output callback function for input-output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • id[in] The id of output callback function for input-output async mode

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_ClearInputOutputCallback(Snpe_BuildConfig_Handle_t bcHandle)

Set the inside output callback handle to NULL for input-output async mode.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetInputOutputInputCallback(Snpe_BuildConfig_Handle_t bcHandle, Snpe_ApplicationBufferMap_Handle_t (*callbackFunc)(Snpe_PSNPE_InputOutputInputAsyncCallbackParam_Handle_t))

Set input callback for input-output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • callbackFunc[in] The input callback function for input-output async mode

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetInputOutputInputCallbackID(Snpe_BuildConfig_Handle_t bcHandle, size_t id)

Set the id of input callback function for input-output async mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • id[in] The id of input callback function for input-output async mode

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_ClearInputOutputInputCallback(Snpe_BuildConfig_Handle_t bcHandle)

Set the inside input callback handle to NULL for input-output async mode.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetInputOutputTransmissionMode(Snpe_BuildConfig_Handle_t bcHandle, Snpe_PSNPE_InputOutputTransmissionMode_t iotMode)

Set the input and output transmission mode including sync mode, output async mode and input-output async mode, defult is sync mode.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • iotMode[in] The typedef of Snpe_PSNPE_InputOutputTransmissionMode_t

Returns

The result error message

Snpe_PSNPE_InputOutputTransmissionMode_t Snpe_BuildConfig_GetInputOutputTransmissionMode(Snpe_BuildConfig_Handle_t bcHandle)

Get the input and output transmission mode including sync mode, output async mode and input-output async mode.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The typedef of Snpe_PSNPE_InputOutputTransmissionMode_t

Snpe_ErrorCode_t Snpe_BuildConfig_SetProfilingLevel(Snpe_BuildConfig_Handle_t bcHandle, Snpe_ProfilingLevel_t profilingLevel)

Set the profiling level for PSNPE build config, default is SNPE_PROFILING_LEVEL_OFF.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • profilingLevel[in] The typedef of Snpe_ProfilingLevel_t

Returns

The result error message

Snpe_ProfilingLevel_t Snpe_BuildConfig_GetProfilingLevel(Snpe_BuildConfig_Handle_t bcHandle)

Get the profiling level for PSNPE build config.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The typedef of Snpe_ProfilingLevel_t

Snpe_ErrorCode_t Snpe_BuildConfig_SetEncode(Snpe_BuildConfig_Handle_t bcHandle, uint64_t encode0, uint64_t encode1)

To be deprecated, set the encode value when you want to divide one image into 2 or 4 parts to run, default is 0 which means the input don’t need dividing.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • encode0[in] The uint64 value of encode0

  • encode1[in] The uint64 value of encode1

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetEncode0(Snpe_BuildConfig_Handle_t bcHandle, uint64_t encode0)

To be deprecated, set the encode0 value for snpe build config which is a special feature used in SM8250.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • encode0[in] The uint64 value of encode0

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetEncode1(Snpe_BuildConfig_Handle_t bcHandle, uint64_t encode1)

To be deprecated, set the encode1 value for snpe build config which is a special feature used in SM8250.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • encode1[in] The uint64 value of encode1

Returns

The result error message

uint64_t *Snpe_BuildConfig_GetEncode(Snpe_BuildConfig_Handle_t bcHandle)

To be deprecated, get the encode0 and encode1 value for snpe build config which is a special feature used in SM8250.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The uint64 value of encode

uint64_t Snpe_BuildConfig_GetEncode0(Snpe_BuildConfig_Handle_t bcHandle)

To be deprecated, get the encode0 value for snpe build config which is a special feature used in SM8250.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The uint64 value of encode0

uint64_t Snpe_BuildConfig_GetEncode1(Snpe_BuildConfig_Handle_t bcHandle)

To be deprecated, get the encode1 value for snpe build config which is a special feature used in SM8250.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The uint64 value of encode1

Snpe_ErrorCode_t Snpe_BuildConfig_SetEnableInitCache(Snpe_BuildConfig_Handle_t bcHandle, int enableInitCache)

Set true or false for enabling init cache for snpe build config, enabling init cache = 1.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • enableInitCache[in] True for enabing init cache

Returns

The result error message

int Snpe_BuildConfig_GetEnableInitCache(Snpe_BuildConfig_Handle_t bcHandle)

Get the satus of enabling init cache for snpe build config, enabling init cache = 1.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • enableInitCache[in] True for enabing init cache

Returns

1 or 0 for enabling init cache

Snpe_ErrorCode_t Snpe_BuildConfig_SetPlatformOptions(Snpe_BuildConfig_Handle_t bcHandle, const char *platformOptions)

Handle needed to access the platformConfig.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • platformOptions[in] Options as a const char*

Returns

The result error message

Snpe_ErrorCode_t Snpe_BuildConfig_SetAcceleratedInit(Snpe_BuildConfig_Handle_t bcHandle, bool acceleratedInit)

Sets the accelerated init mode for HTP runtime for execution from an offline prepared cache. If DLC without HTP cache is called with this mode, the program terminates. Init acceleration requires cache prepared with current SDK; older cache falls back to regular initialization. If an offline prepared model with an invalid cache is discovered, the program continues normal execution with a warning.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • acceleratedInit[in] Boolean If set to true, enables HTP Init accelerate.

Note

Init time is reduced by using more resources. This would cause execution to slow down if executes are done concurrently with initialization. This should only be used for an offline prepared DLC, for DSP (HTP) runtime. Default value is false.

int Snpe_BuildConfig_GetAcceleratedInit(Snpe_BuildConfig_Handle_t bcHandle)

To return the bool value of acceleratedInit of build config.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The bool value of acceleratedInit

const char *Snpe_BuildConfig_GetPlatformOptions(Snpe_BuildConfig_Handle_t bcHandle)

Get the optional platform features for snpe build config.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

Options as a const char*

Snpe_ErrorCode_t Snpe_BuildConfig_SetDiaglogOutputDir(Snpe_BuildConfig_Handle_t bcHandle, const char *diaglogOutputDir)

Set the path directory of output diag log you want to save.

Parameters
  • bcHandle[in] Handle to access the object of snpe build config

  • diaglogOutputDir[in] The string directory

Returns

The result error message

const char *Snpe_BuildConfig_GetDiaglogOutputDir(Snpe_BuildConfig_Handle_t bcHandle)

Get the path of output diag log.

Parameters

bcHandle[in] Handle to access the object of snpe build config

Returns

The string directory

Snpe_PSNPE_Handle_t Snpe_PSNPE_Create()

Create the handle of PSNPE object.

Returns

The handle of PSNPE object

Snpe_ErrorCode_t Snpe_PSNPE_Delete(Snpe_PSNPE_Handle_t psnpeHandle)

Release the handle of PSNPE object.

Parameters

psnpeHandle[in] Handle to access the PSNPE object

Returns

The result error message

Snpe_ErrorCode_t Snpe_PSNPE_Build(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_BuildConfig_Handle_t bcHandle)

Build the instance of PSNPE object accorading of snpe build config.

Returns

The result error message

Snpe_ErrorCode_t Snpe_PSNPE_Execute(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_UserBufferList_Handle_t inputBufferListHandle, Snpe_UserBufferList_Handle_t outputBufferListHandle)

Execute PSNPE object for sync mode.

Parameters
  • psnpeHandle[in] Handle to access the PSNPE object

  • inputBufferListHandle[in] Handle to access the input user buffer list

  • outputBufferListHandle[in] Handle to access the output user buffer list

Returns

The result error message

Snpe_ErrorCode_t Snpe_PSNPE_ExecuteInputOutputAsync(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_StringList_Handle_t inputMapHandle, size_t dataIndex, int isTF8buff, int isTF8Outputbuff)

Execute PSNPE object for input-output async mode.

Parameters
  • psnpeHandle[in] Handle to access the PSNPE object

  • inputMapHandle[in] Handle to access the input buffer map

  • dataIndex[in] The index of input data

  • isTF8buff[in] If the input buffer is TF8

  • isTF8Outputbuff[in] If the output buffer is TF8

Returns

The result error message

Snpe_StringList_Handle_t Snpe_PSNPE_GetInputTensorNames(Snpe_PSNPE_Handle_t psnpeHandle)

Get the input tensor names for PSNPE object.

Parameters

bcHandle[in] Handle to access the PSNPE object

Returns

The string list of input tensor names

Snpe_StringList_Handle_t Snpe_PSNPE_GetOutputTensorNames(Snpe_PSNPE_Handle_t psnpeHandle)

Get the output tensor names for PSNPE object.

Parameters

bcHandle[in] Handle to access the PSNPE object

Returns

The string list of output tensor names

Snpe_TensorShape_Handle_t Snpe_PSNPE_GetInputDimensions(Snpe_PSNPE_Handle_t psnpeHandle)

Get the input dimension shape for PSNPE object.

Parameters

bcHandle[in] Handle to access the PSNPE object

Returns

The tensor shape of input dimension

Snpe_TensorShape_Handle_t Snpe_PSNPE_GetInputDimensions_Name(Snpe_PSNPE_Handle_t psnpeHandle, const char *name)

Get the input dimension shape for the specific input name for PSNPE object.

Parameters
  • bcHandle[in] Handle to access the PSNPE object

  • name[in] The name of input data

Returns

The tensor shape of a specific input name

Snpe_TensorShape_Handle_t Snpe_PSNPE_GetBufferAttributesDims(Snpe_PSNPE_Handle_t psnpeHandle, const char *name)

Get the number of elements in each dimension for input and output buffer.

Parameters
  • bcHandle[in] Handle to access the PSNPE object

  • name[in] The name of input and output buffer

Returns

Dimension size

Snpe_ErrorCode_t Snpe_PSNPE_RegisterIonBuffers(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_UserMemoryMap_Handle_t ionBufferMapHandle)
Snpe_ErrorCode_t Snpe_PSNPE_DeregisterIonBuffers(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_StringList_Handle_t ionBufferNames)
Snpe_ErrorCode_t Snpe_PSNPE_RegisterUserMemoryMappedBuffers(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_UserMemoryMap_Handle_t bufferMapHandle)

Register Client Memory-Mapped Buffers (Example ION buffers in Android)

Parameters
  • snpeHandle[in] Handle to access the SNPE object

  • bufferMapHandle[in] A UserMemoryMap of virtual addresses

Returns

SNPE_SUCCESS upon successful memory mapped buffer registration

Note

UserBuffer type passed for registration must match the data type of the tensor in the dlc For regular UserBuffers SNPE performs an online data conversion (quantization or dequantization etc). This is not possible for memory mapped buffers hence can lead to issues during execution or accuracy degradation

Snpe_ErrorCode_t Snpe_PSNPE_DeregisterUserMemoryMappedBuffers(Snpe_PSNPE_Handle_t psnpeHandle, Snpe_StringList_Handle_t bufferNamesHandle)

Deregister Client Memory-Mapped Buffers (Example ION buffers in Android)

Parameters
  • snpeHandle[in] Handle to access the SNPE object

  • bufferNamesHandle[in] A StringList of memory mapped buffer names

Returns

SNPE_SUCCESS upon successful memory mapped buffer deregistration

const char *Snpe_PSNPE_GetLastErrorString(Snpe_PSNPE_Handle_t psnpeHandle)

Get the error message during the failed execution.

Parameters

bcHandle[in] Handle to access the PSNPE object

Returns

The error message

Snpe_IBufferAttributes_Handle_t Snpe_PSNPE_GetInputOutputBufferAttributes(Snpe_PSNPE_Handle_t psnpeHandle, const char *name)

Get the handle of IBufferAttributes.

Parameters
  • bcHandle[in] Handle to access the PSNPE object

  • name[in] The name of attribute buffer

Returns

Handle to access IBufferAttributes

Snpe_IBufferAttributes_Handle_t Snpe_PSNPE_GetInputOutputBufferAttributesForNetwork(Snpe_PSNPE_Handle_t psnpeHandle, const char *networkName, const char *name)

Get the handle of IBufferAttributes.

Parameters
  • bcHandle[in] Handle to access the PSNPE object

  • networkName[in] Network name.

  • name[in] The name of attribute buffer

Returns

Handle to access IBufferAttributes

Snpe_ErrorCode_t Snpe_PSNPE_SetPerformanceProfile(Snpe_PSNPE_Handle_t psnpeHandle, size_t instanceIdx, Snpe_PerformanceProfile_t performanceProfile)

Set the performance profile level of PSNPE object.

Parameters
  • psnpeHandle[in] Handle to access the PSNPE object

  • instanceIdx[in] The idx of SNPE object

  • performanceProfile[in] The perf profile level

Returns

SNPE_SUCCESS upon successful setting of performance profile

Snpe_ErrorCode_t Snpe_PSNPE_SetCustomPerfProfile(Snpe_PSNPE_Handle_t psnpeHandle, size_t instanceIdx, Snpe_SNPEPerfProfile_Handle_t perfProfileHandle)

Set the custom performance profile level of PSNPE object.

Parameters
  • psnpeHandle[in] Handle to access the PSNPE object

  • instanceIdx[in] The idx of SNPE object

  • performanceProfile[in] Handle to accesss the SNPEPerfProfile object

Returns

SNPE_SUCCESS upon successful setting of custom performance profile

struct Snpe_UserBufferData_t
#include <PSNPE.h>

A struct to indicate userbuffer data type in output callback of input-output async mode.

Public Members

const uint8_t *data

data for the one output

size_t size

the data size of this output