Developer World
Spresense Arduino Library v3.3.0-b2e6327
DNNRT Class Reference

Public Member Functions

int begin (File &nnbfile, unsigned char cpu_num=1)
 
int end ()
 
int inputVariable (DNNVariable &var, unsigned int index)
 
DNNVariableoutputVariable (unsigned int index)
 
int forward ()
 
int numOfInput ()
 
int inputSize (unsigned int index)
 
int inputDimension (unsigned int index)
 
int inputShapeSize (unsigned int index, unsigned int shapeindex)
 
int numOfOutput ()
 
int outputSize (unsigned int index)
 
int outputDimension (unsigned int index)
 
int outputShapeSize (unsigned int index, unsigned int shapeindex)
 

Member Function Documentation

◆ begin()

int DNNRT::begin ( File nnbfile,
unsigned char  cpu_num = 1 
)

Initialize runtime object from .nnb file

User must be generate a network model data file (.nnb) by Neural Network Console (NNC) before use this library.

About Neural Network Console: https://dl.sony.com/

Parameters
nnbfilennb network model binary file
cpu_numthe number of CPUs to be used by DNN runtime (default 1)
Returns
0 on success, otherwise error.
Return values
-22(-EINVAL)invalid argument of cpu_num
-16(-EBUSY)dnnrt-mp included in bootloader isn't installed, or no memory space to load it.
-1no memory space to load nnbfile
-2communication error with dnnrt-mp
-3illegal input/output data in network model

◆ end()

int DNNRT::end ( )

Finalize runtime object

Returns
0 on success, otherwise error.

◆ inputVariable()

int DNNRT::inputVariable ( DNNVariable var,
unsigned int  index 
)

Set input data at index

Parameters
[in]varInput data to the network
[in]indexIndex of input data
Returns
0 on success, otherwise error.
Note
Number of input data is depends on the network model.

◆ outputVariable()

DNNVariable & DNNRT::outputVariable ( unsigned int  index)

Get output data at index

Parameters
[in]indexIndex of output data
Returns
Output variable data. the shape of output data is depends on the network model.

◆ forward()

int DNNRT::forward ( )

Execute forward propagation

Returns
0 on success, otherwise error.

◆ numOfInput()

int DNNRT::numOfInput ( )

Get number of network inputs

Returns
Number of input data

◆ inputSize()

int DNNRT::inputSize ( unsigned int  index)

Size of input data at index

Parameters
[in]indexIndex of input data
Returns
Number of input data elements

◆ inputDimension()

int DNNRT::inputDimension ( unsigned int  index)

Get dimension of input data at index

Parameters
[in]indexIndex of input data
Returns
Number of input data dimension

◆ inputShapeSize()

int DNNRT::inputShapeSize ( unsigned int  index,
unsigned int  shapeindex 
)

Shape size at shape index

Parameters
[in]indexIndex of input data
[in]shapeindexIndex of shape
Returns
Shape size

◆ numOfOutput()

int DNNRT::numOfOutput ( )

Get number of network outputs

Returns
Number of output data

◆ outputSize()

int DNNRT::outputSize ( unsigned int  index)

Size of output data at index

Parameters
[in]indexIndex of output data
Returns
Number of output data elements

◆ outputDimension()

int DNNRT::outputDimension ( unsigned int  index)

Get dimension of output data at index

Parameters
[in]indexIndex of output data
Returns
Number of dimension

◆ outputShapeSize()

int DNNRT::outputShapeSize ( unsigned int  index,
unsigned int  shapeindex 
)

Shape size at output shape index

Parameters
[in]indexIndex of output data
[in]shapeindexIndex of output data
Returns
Shape size

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