Main Content

predict

Predict response of eNPU based on given data

Since R2025a

Description

response = predict(enpu,InputSignal) predicts response of eNPU based on given data.

example

Examples

collapse all

Predict response of eAI network by selecting the option to quantize the input and then providing the input data of single data type.

Create hexagon.ENPU System object, by specifying the eAI network file and the input and output quantization range.

enpu = hexagon.ENPU('EAINetworkFile','model_eNPU_on_v3.eai',...
        'InputQuantizationRange',[-6 2.5],...
        'DequantizeOutput',true,...
        'OutputQuantizationRange',[0 1]);

Specify the input signal and call the predict function to obtain the response from the deep learning network .

x = 3.5
response = predict(enpu, x)

Input Arguments

collapse all

hexagon.ENPU System object

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

The hexagon.ENPU System object supports 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.

The predict function accepts either floating-point input (which requires quantization using other block parameters) or fixed-point input.

Data type of input signal must match with the eAI model if its input layer is of type int8, int16 or int32. If the input signal data type is single, set the property InputQuantizationRange during hexagon.ENPU object creation, before using the predict function.

Data Types: single | int8 | int16 | int32

Output Arguments

collapse 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.

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

The predict function always returns quantized data, with the data type as int8, int16 or int32 as per the eAI network. To obtain single-precision output, set the property DequantizeOutput to true and specify the OutputQuantizationRange value during hexagon.ENPU object creation.

Version History

Introduced in R2025a

See Also