主要内容

hexagon.ENPU

Interface to predict responses of eNPU using a compiled eAI model

Since R2025a

Description

The hexagon.ENPU System object is an interface to predict responses of eNPU using a compiled eAI model.

To create the interface to predict responses of eNPU:

  1. Create the hexagon.ENPU object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

enpu = hexagon.ENPU(EAINetworkFile=EAINetworkFile) creates an eNPU interface to predict responses by using a compiled embedded Artificial Intelligence (eAI) model designed for Qualcomm® eNPU.

enpu = hexagon.ENPU(EAINetworkFile=CompiledEAIModel,Name=Value) sets Properties using one or more name-value arguments.

Input Arguments

expand all

Compiled eAI (embedded Artificial Intelligence) model designed for Qualcomm eNPU, specified as a string. The deep learning network represented as an eAI model (eAI network file) must be generated using the LPAI SDK Addon for Qualcomm Hexagon® SDK.

If the EAI model is not present in the Current Folder in MATLAB, specify the absolute path along with <filename>.eai

Data Types: string

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: hexagon.ENPU(EAINetworkFile='model_eNPU_on_v3.eai', InputQuantizationRange=[[0, 255])

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Minimum and maximum range of input values for quantization of floating-point input, specified as an M-by-2 array containing M number of [min,max] values, where M is the count of input layers. To know about the count of input layer used in the eAI model, use the hexagon.ENPU.getEAIProperties function.

Note

Specifying a value range for quantization is not required if you are using the latest LPAI Add-on version 2.5.0.0. Therefore, this property is required only for older versions of LPAI Add-On.

The System object supports both symmetric quantization (absolute value of minimum and maximum values are same) and asymmetric quantization (absolute value of minimum and maximum values are different).

Example: For predicting responses of a tensor layout with two inputs and quantize both inputs, use the command: hexagon.ENPU(EAINetworkFile='model_eNPU_on_v3.eai', InputQuantizationRange=[[0, 255];[0,255]])

Data Types: struct

Enable quantization of output, to allow specifying the output quantization range, if input quantization is enabled.

Data Types: logical

Minimum and maximum range of output values for quantization of floating-point output, specified as an M-by-2 array containing M number of [min,max] values, where M is the count of output layers.

Note

Specifying a value range for quantization is not required if you are using the latest LPAI Add-on version 2.5.0.0. Therefore, this property is required only for older versions of LPAI Add-On.

The System object supports both symmetric quantization (absolute of minimum and maximum values are same) and asymmetric quantization (absolute of minimum and maximum values are different).

Example: For predicting responses of a tensor layout with two inputs and two outputs, and quantize both inputs and outputs, use this command: hexagon.ENPU(EAINetworkFile='model_eNPU_on_v3.eai', InputQuantizationRange=[[0, 255];[0,255]],DequantizeOutput=true, OutputQuantizationRange=[[0, 255];[0, 255]])

Dependencies

To enable this property, set DequantizeOutput property to true.

Data Types: struct

Specifies if the selected eAI network uses default client performance configuration while obtaining response. The default values as per the LPAI SDK Addon documentation are:

  • Frames per second: 1

  • Faster Than Real Time (FTRT) ratio: 10

  • Priority level: 3

.

Data Types: logical

Number of frames to be processed per second while predicting response using the eAI model. For more information, refer to Qualcomm LPAI SDK documentation.

Dependencies

To enable this property, set UseDefaultClientPerformanceConfig to false.

Ratio to be considered for faster than real-time performance while predicting response using the eAI model. For more information, refer to Qualcomm LPAI SDK documentation.

Dependencies

To enable this property, set UseDefaultClientPerformanceConfig to false.

Client priority level for eNPU scheduling while predicting response using the eAI model. The corresponding priorities for these values are:

  • 3 – Very low

  • 2 – Low

  • 1 – Medium

  • 0 – High

For more information, refer to Qualcomm LPAI SDK documentation.

Dependencies

To enable this property, set UseDefaultClientPerformanceConfig to false.

Specify if real-time processing of input data is required while predicting response using the eAI model.

Dependencies

To enable this property, set UseDefaultClientPerformanceConfig to false.

Usage

Description

enpuresponse = enpu(x) predicts responses of eNPU based on the input data, x

Instead of calling the System object directly, you can also use the Predict function to obtain the response.

Input Arguments

expand all

The input signal, specified as an N-dimensional array. The array must be of the same size specified for the Input layer size parameter of the eAI model.

The System objects support multiple-input multiple-output tensor with a maximum of four dimensions, but the batch size must always be 1. For example, if the input layer of the original deep learning network is 128-by-128-by-3, the input signal dimension must be either 128-by-128-by-3 or 1-by-128-by-128-by-3.

If the leading dimensions are 1 (singleton dimensions), you can remove these dimensions without affecting compatibility. For example, if the input layer of an AI model expects an input of size 1-by-1-by-128-by-3, you can specify an input of size 1-by-1-by-128-by-3 or 128-by-3. You can remove these dimensions because dimensions of size 1 can be broadcast to match the expected shape.

Data type of input signal must match with the eAI model (eAI network file) if its input layer is of type int8, int16 or int32. If the input signal data type is single, specify the InputQuantizationRange parameter.

Data Types: single | half | int8 | int16 | int32 | uint8 | uint16 | uint32

Output Arguments

expand all

The response after computing predictions using the selected eAI model , represented as an N-dimensional array. The array is of the same size as specified in the Output layer size parameter of the eAI model.

Data type of output signal must match with the eAI model (eAI network file) if its input layer is of type int8, int16 or int32. If the output signal data type is single, select the DequantizeOutput property to true and specify the OutputQuantizationRange value.

.

The System object supports a multiple-input multiple-output tensor with a maximum of four dimensions, but the batch size must always be 1.

Data Types: single | half | int8 | int16 | int32 | uint8 | uint16 | uint32

Object Functions

To use an object function, specify the System object™ as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

hexagon.ENPU.getEAIPropertiesRead values for properties defined in eAI network file
predictPredict response based on given data using System objects created for QNN backends (HTP, CPU, or LPAI) or eNPU
releaseRelease resources and allow changes to System object property values and input characteristics
cloneCreate duplicate System object

Examples

collapse all

  1. Prepare the eAI network file (eAI model). To create interface to eNPU by using eAI model, it is recommended that you copy the file to the Current Folder in MATLAB. Alternatively, you can note the absolute path of the file.

  2. Run this command to create the interface object, if the eAI network file (for example, model_eNPU_on_v3.eai) is present in the Current Folder in MATLAB.

    hexagon.ENPU(EAINetworkFile='model_eNPU_on_v3.eai')

  1. Prepare the eAI network file (eAI model). To create interface to eNPU by using eAI model, it is recommended that you copy the file to the Current Folder in MATLAB. Alternatively, you can note the absolute path of the file.

  2. Run this command to create the interface object by also mentioning the input quantization range, if the eAI network file (for example, model_eNPU_on_v3.eai) is present in the Current Folder in MATLAB .

    hexagon.ENPU(EAINetworkFile='model_eNPU_on_v3.eai', InputQuantizationRange=[[0, 255];[0,255]]

Version History

Introduced in R2025a