Bolt
com.huawei.noah.BoltModel Class Reference
Inheritance diagram for com.huawei.noah.BoltModel:
Collaboration diagram for com.huawei.noah.BoltModel:

Public Member Functions

 BoltModel (String modelPath, AffinityType affinity, int inputNum, String[] inputName, int[] inputN, int[] inputC, int[] inputH, int[] inputW, DataType[] inputDataType, DataFormat[] inputDataFormat)
 initial model and alloc memory More...
 
 BoltModel (String modelPath, AffinityType affinity, int inputNum, String[] inputName, int[] inputN, int[] inputC, int[] inputH, int[] inputW, DataType[] inputDataType, DataFormat[] inputDataFormat, int outputNum, String[] outputName)
 initial model and alloc memory, and the output is decided by user More...
 
void setRuntimeDevice (int cpuId, DeviceType device) throws FileNotFoundException
 set process to run on specified CPU core More...
 
void setRuntimeDeviceDynamic () throws FileNotFoundException
 set process cpu affinity according cpu average occupy More...
 
native void setNumThreads (int threads)
 set parallel threads num More...
 
BoltResult run (int inputNum, String[] inputName, float[][] inputData)
 inference result from input More...
 
BoltResult run (int inputNum, String[] inputName, int[] inputN, int[] inputC, int[] inputH, int[] inputW, DataType[] inputDataType, DataFormat[] inputDataFormat, float[][] inputData)
 inference result from resized input More...
 
void destructor ()
 recycle memory and destroy model More...
 

Protected Member Functions

Object clone ()
 clone BoltModel More...
 

Detailed Description

Definition at line 26 of file BoltModel.java.

Constructor & Destructor Documentation

◆ BoltModel() [1/2]

com.huawei.noah.BoltModel.BoltModel ( String  modelPath,
AffinityType  affinity,
int  inputNum,
String []  inputName,
int []  inputN,
int []  inputC,
int []  inputH,
int []  inputW,
DataType []  inputDataType,
DataFormat []  inputDataFormat 
)

initial model and alloc memory

Parameters
modelPathmodel file path of String type
affinityCPU affinity setting of AffinityType(enum) type
inputNumthe number of input data of int type
inputNamethe array of all input data's name of string type
inputNthe array of all input data's n dimension of int type
inputCthe array of all input data's c dimension of int type
inputHthe array of all input data's h dimension of int type
inputWthe array of all input data's w dimension of int type
inputDataTypethe array of all input data's data type of DataType(enum) type
inputDataFormatthe array of all input data's data format of DataFormat(enum) type
Returns
Note
destroy model when pipeline end
BoltModel example = BoltModel(...);
...
example.estructor();

Definition at line 63 of file BoltModel.java.

◆ BoltModel() [2/2]

com.huawei.noah.BoltModel.BoltModel ( String  modelPath,
AffinityType  affinity,
int  inputNum,
String []  inputName,
int []  inputN,
int []  inputC,
int []  inputH,
int []  inputW,
DataType []  inputDataType,
DataFormat []  inputDataFormat,
int  outputNum,
String []  outputName 
)

initial model and alloc memory, and the output is decided by user

Parameters
modelPathmodel file path of String type
affinityCPU affinity setting of AffinityType(enum) type
inputNumthe number of input data of int type
inputNamethe array of all input data's name of string type
inputNthe array of all input data's n dimension of int type
inputCthe array of all input data's c dimension of int type
inputHthe array of all input data's h dimension of int type
inputWthe array of all input data's w dimension of int type
inputDataTypethe array of all input data's data type of DataType(enum) type
inputDataFormatthe array of all input data's data format of DataFormat(enum) type
outputNumthe number of output data of int type
outputNamethe array of all output data's name of string type
Returns
Note
destroy model when pipeline end
BoltModel example = BoltModel(...);
...
example.estructor();

Definition at line 116 of file BoltModel.java.

Member Function Documentation

◆ clone()

Object com.huawei.noah.BoltModel.clone ( )
protected

clone BoltModel

Returns
cloneModel: shared weight with original model but has different tensor space

Definition at line 152 of file BoltModel.java.

◆ destructor()

void com.huawei.noah.BoltModel.destructor ( )

recycle memory and destroy model

Returns

Definition at line 273 of file BoltModel.java.

◆ run() [1/2]

BoltResult com.huawei.noah.BoltModel.run ( int  inputNum,
String []  inputName,
float  inputData[][] 
)

inference result from input

Parameters
inputNumthe number of input data of int type
inputNamethe array of all input data's name of string type
inputDatathe 2D array of all input data of float type
Returns
BoltResult : the result class of bolt model after inference

Definition at line 215 of file BoltModel.java.

◆ run() [2/2]

BoltResult com.huawei.noah.BoltModel.run ( int  inputNum,
String []  inputName,
int []  inputN,
int []  inputC,
int []  inputH,
int []  inputW,
DataType []  inputDataType,
DataFormat []  inputDataFormat,
float  inputData[][] 
)

inference result from resized input

Parameters
inputNumthe number of input data of int type
inputNamethe array of all input data's name of String type
inputNthe array of all input data's n dimension of int type
inputCthe array of all input data's c dimension of int type
inputHthe array of all input data's h dimension of int type
inputWthe array of all input data's w dimension of int type
inputDataTypethe array of all input data's data type of DataType(enum) type
inputDataFormatthe array of all input data's data format of DataFormat(enum) type
inputDatathe 2D array of all input data of float type
Returns
BoltResult : the result class of bolt model after inference

Definition at line 240 of file BoltModel.java.

◆ setNumThreads()

native void com.huawei.noah.BoltModel.setNumThreads ( int  threads)

set parallel threads num

Parameters
threadsnumber of threads
Note
This can only be used before run. This setting is global to each inference threads.
Returns

Referenced by com.huawei.noah.BoltModel.setRuntimeDeviceDynamic().

◆ setRuntimeDevice()

void com.huawei.noah.BoltModel.setRuntimeDevice ( int  cpuId,
DeviceType  device 
) throws FileNotFoundException

set process to run on specified CPU core

Parameters
cpuIdcpu core id(0, 1, 2...)
devicecpu core architecture(ARM_A76)
Returns

Definition at line 175 of file BoltModel.java.

◆ setRuntimeDeviceDynamic()

void com.huawei.noah.BoltModel.setRuntimeDeviceDynamic ( ) throws FileNotFoundException

set process cpu affinity according cpu average occupy

Returns

Definition at line 188 of file BoltModel.java.

References com.huawei.noah.BoltModel.setNumThreads().


The documentation for this class was generated from the following file: