class
#include <graph.hpp>
Graph Class for managing QNN graphs.
Contents
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Graph&) -> Graph & deleted
- auto operator=(Graph&&) -> Graph & deleted
- auto getInputs() -> nonstd::span< Qnn_Tensor_t >
- Get the input tensors for the current graph.
- auto getOutputs() -> nonstd::span< Qnn_Tensor_t >
- Get the output tensors for the current graph.
- auto loadFromSharedLibrary(const std::filesystem::path& modelPath) -> STATUS
- auto createContext(QNN_INTERFACE_VER_TYPE& qnnInterface, Qnn_BackendHandle_t& backendHandle, Qnn_DeviceHandle_t& deviceHandle) -> STATUS
- auto composeGraphs(Qnn_BackendHandle_t& qnnBackendHandle) -> STATUS
- auto setGraphConfig(DELEGATE delegate, TensorType precision) -> STATUS
- Sets the configuration for the composed graphs.
- auto finalizeGraphs() -> STATUS
- Finalizes the composed graphs.
- auto loadSystemLibrary() -> STATUS
- auto loadContextFromBinary(QNN_INTERFACE_VER_TYPE& qnnInterface, Qnn_BackendHandle_t& backendHandle, Qnn_DeviceHandle_t& deviceHandle, const nonstd::span<uint8_t>& modelBuffer) -> STATUS
- auto saveContextBinary(const std::filesystem::path& binaryPath) -> STATUS
- Saves the current context to a binary file.
- auto retrieveGraphFromContext() -> STATUS
- Retrieves a graph from the current context.
- auto execute() -> STATUS
- Executes the graph.
Function documentation
auto edge:: qnn:: Graph:: getInputs() -> nonstd::span< Qnn_Tensor_t >
Get the input tensors for the current graph.
Returns | A span of input tensors. |
---|
auto edge:: qnn:: Graph:: getOutputs() -> nonstd::span< Qnn_Tensor_t >
Get the output tensors for the current graph.
Returns | A span of output tensors. |
---|
auto edge:: qnn:: Graph:: loadFromSharedLibrary(const std::filesystem::path& modelPath) -> STATUS
Parameters | |
---|---|
modelPath | The path to the shared library containing the model. |
Returns | STATUS The status of the operation (SUCCESS or ERROR). |
Loads a model from a shared library located at the specified path.
auto edge:: qnn:: Graph:: createContext(QNN_INTERFACE_VER_TYPE& qnnInterface,
Qnn_BackendHandle_t& backendHandle,
Qnn_DeviceHandle_t& deviceHandle) -> STATUS
Parameters | |
---|---|
qnnInterface | The handle of the QNN interface. |
backendHandle | The handle to the QNN backend. |
deviceHandle | The handle to the QNN device. |
Returns | STATUS The status of the operation (SUCCESS or ERROR). |
Creates a context for the QNN interface with the specified backend and device handles.
Graph keeps a reference to the qnnInterface
auto edge:: qnn:: Graph:: composeGraphs(Qnn_BackendHandle_t& qnnBackendHandle) -> STATUS
Parameters | |
---|---|
qnnBackendHandle | The handle to the QNN backend. |
Returns | STATUS The status of the operation (SUCCESS or ERROR). |
Composes graphs using the specified QNN backend handle.
auto edge:: qnn:: Graph:: setGraphConfig(DELEGATE delegate,
TensorType precision) -> STATUS
Sets the configuration for the composed graphs.
Parameters | |
---|---|
delegate | The delegate for the operation. |
precision | The precision of the operation. |
Returns | The status of the operation. |
auto edge:: qnn:: Graph:: finalizeGraphs() -> STATUS
Finalizes the composed graphs.
Returns | The status of the operation. |
---|
auto edge:: qnn:: Graph:: loadSystemLibrary() -> STATUS
Returns | STATUS indicating the success or failure of loading the system library. |
---|
Loads the system library required for loading a cached context from a binary buffer
auto edge:: qnn:: Graph:: loadContextFromBinary(QNN_INTERFACE_VER_TYPE& qnnInterface,
Qnn_BackendHandle_t& backendHandle,
Qnn_DeviceHandle_t& deviceHandle,
const nonstd::span<uint8_t>& modelBuffer) -> STATUS
Parameters | |
---|---|
qnnInterface | The handle of the QNN interface. |
backendHandle | The handle to the QNN backend. |
deviceHandle | The handle to the QNN device. |
modelBuffer | The binary model buffer containing the model data. |
Returns | STATUS indicating the success or failure of loading the context from the binary model buffer. |
Loads the context from a binary model buffer.
Graph keeps a reference to the qnnInterface
auto edge:: qnn:: Graph:: saveContextBinary(const std::filesystem::path& binaryPath) -> STATUS
Saves the current context to a binary file.
Parameters | |
---|---|
binaryPath | The path to save the context binary file. |
Returns | The status of the operation. |
auto edge:: qnn:: Graph:: retrieveGraphFromContext() -> STATUS
Retrieves a graph from the current context.
Returns | STATUS - A status code indicating the success or failure of the operation. |
---|
This function retrieves a graph from the current context and returns a status code indicating the success or failure of the operation.
auto edge:: qnn:: Graph:: execute() -> STATUS
Executes the graph.
Returns | STATUS - A status code indicating the success or failure of the operation. |
---|
This function executes the graph and returns a status code indicating the success or failure of the operation.