Functions | |
| void | Cy_NNLite_LeakyRelUPWLActivation (float alpha_scale, float unit_scale, cy_nn_act_intrpl_param_t *leakyRelU) |
| Set PWL interpolation parameters for LeakyRElU activation. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Convolution (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, const int8_t *filterData, const int32_t *biasData, cy_nn_conv_params_t *convParam, cy_en_nnlite_fused_activation_t actType, cy_nn_act_intrpl_param_t *intrplParam) |
| 2D Convolution CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function More... | |
| cy_en_nnlite_status_t | Cy_NNLite_ConvolutionDMA (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, const int8_t *filterData, const int32_t *biasData, cy_nn_conv_params_t *convParam, cy_en_nnlite_fused_activation_t actType, cy_nn_act_intrpl_param_t *intrplParam) |
| 2D Convolution DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_DepthwiseConvolution (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, const int8_t *filterData, const int32_t *biasData, cy_nn_conv_params_t *convParam, cy_en_nnlite_fused_activation_t actType, cy_nn_act_intrpl_param_t *intrplParam) |
| Depthwise Convolution CPU mode kernel API, API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_DepthwiseConvolutionDMA (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, const int8_t *filterData, const int32_t *biasData, cy_nn_conv_params_t *convParam, cy_en_nnlite_fused_activation_t actType, cy_nn_act_intrpl_param_t *intrplParam) |
| Depthwise DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_FullyConnected (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, const int8_t *filterData, const int32_t *biasData, cy_nn_fc_params_t *fcParam, cy_en_nnlite_fused_activation_t actType, cy_nn_act_intrpl_param_t *intrplParam) |
| Fully connected CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode For case inputDims->dims[0] > 1,scratch buffer is required scratch buffer size in CPU should be calculated using Cy_NNLite_FC_ScratchBufSize API if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_FullyConnectedDMA (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, const int8_t *filterData, const int32_t *biasData, cy_nn_fc_params_t *fcParam, cy_en_nnlite_fused_activation_t actType, cy_nn_act_intrpl_param_t *intrplParam) |
| Fully connected DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Avgpool (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, cy_nn_pool_params_t *avgpoolParam) |
| Average pool CPU mode kernel API, API will configure nnlite. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_AvgpoolDMA (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, cy_nn_pool_params_t *avgpoolParam) |
| Average pool CPU mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Maxpool (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, cy_nn_pool_params_t *poolParam) |
| Max pool CPU mode kernel API, API will configure nnlite. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_MaxpoolDMA (const int8_t *inputData, int8_t *outData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_dims_t *filterDims, cy_nn_pool_params_t *poolParam) |
| Max pool CPU mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Scaling_Setup (cy_nn_scaling_t *ss, float lhs_scale, float rhs_scale, float output_scale, cy_en_nnlite_activation_size_t input_size, cy_en_nnlite_op_t op_type, cy_en_nnlite_fused_activation_t act_type) |
| Precomputation of NPU scaling factor settings for NPU binary operations. More... | |
| void | Cy_NNLite_Scaling_Q_Setup (cy_nn_scaling_t *ss) |
| Set scaling configuration to "no scaling" (fast) More... | |
| cy_en_nnlite_status_t | Cy_NNLite_AddSubMul (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams, cy_en_nnlite_op_t op_type, cy_en_nnlite_fused_activation_t act_type) |
| Generic binary op CPU mode kernel API, API will configure nnlite. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_AddSubMulDMA (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams, cy_en_nnlite_op_t op_type, cy_en_nnlite_fused_activation_t act_type) |
| Generic binary op CPU mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Add (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams) |
| Pointwise addition operation. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_AddDMA (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams) |
| Pointwise addition operation. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Sub (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams, bool left_from_right) |
| Pointwise addition operation. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_SubDMA (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams, bool left_from_right) |
| Pointwise addition operation. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Mul (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams) |
| multiplication More... | |
| cy_en_nnlite_status_t | Cy_NNLite_MulDMA (const int8_t *lhsData, const int8_t *rhsData, int8_t *outData, const cy_nn_dims_t *lhsDims, const cy_nn_dims_t *rhsOutDims, const cy_nn_pwise_binary_params_t *pwParams) |
| Pointwise multiplication with simple broadcast. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Activation (const int8_t *inData, int8_t *outData, const cy_nn_dims_t *inoutDims, const cy_nn_pwise_unary_params_t *actParams, cy_en_nnlite_fused_activation_t act_type, cy_nn_act_intrpl_param_t *intrplParam) |
| Unfused Activation function CPU mode kernel API, API will configure nnlite and then start nnlite operation. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_ActivationDMA (const int8_t *inData, int8_t *outData, const cy_nn_dims_t *inoutDims, const cy_nn_pwise_unary_params_t *actParams, cy_en_nnlite_fused_activation_t act_type, cy_nn_act_intrpl_param_t *intrplParam) |
| Unfused Activation function DMA mode kernel API,API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_LayerNorm (const int8_t *inputData, int8_t *outputData, const cy_nn_dims_t *inputDims, const cy_nn_dims_t *outputDims, const cy_nn_layernorm_params_t *lnParams) |
| Compute composite LayerNorm operation. More... | |
| uint32_t | Cy_NNLite_LayerNormScratchBufSize (const cy_nn_dims_t *inputDims, cy_en_nnlite_activation_size_t inputSize) |
| API will return scratch buffer size for LayerNorm kernel, buffer will be used for intermediate calculations. | |
| cy_en_nnlite_status_t | Cy_NNLite_Byte_Copy (const int8_t *inData, int8_t *outData, uint32_t count) |
| Byte block copy using NNLite. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_Q31Reciprocal (const uint32_t *inData, float *outData, const cy_nn_dims_t *inoutDims) |
| Float reciprocal of (sums of) unsigned Q.31 values CPU mode kernel API. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_LSTM_Int8 (cy_nn_lstm_context *scratch_buffers, const int8_t *input_data, const cy_nn_lstm_dims *lstm_dims, const int8_t *input_to_input_weights, const int8_t *input_to_forget_weights, const int8_t *input_to_cell_weights, const int8_t *input_to_output_weights, const int8_t *recurrent_to_input_weights, const int8_t *recurrent_to_forget_weights, const int8_t *recurrent_to_cell_weights, const int8_t *recurrent_to_output_weights, const int8_t *projection_weights, const cy_nn_lstm_params *lstm, int8_t *output_state, int16_t *cell_state, int8_t *output_data) |
| LSTM unidirectional function with 8 bit input and output and 16 bit gate output Peephole connections, projection, clipping, combined input/forget gate and layer normalization are not supported. More... | |
| uint32_t | Cy_NNLite_SoftMax_ScratchBufSize (const cy_nn_dims_t *inoutDims, const cy_en_nnlite_activation_size_t act_size) |
| Compute scratch buffer size needed to compute row-wise softmax of 2D input tensor. More... | |
| uint32_t | Cy_NNLite_FC_ScratchBufSize (const cy_nn_dims_t *inDims, const cy_nn_dims_t *outDims) |
| Compute size scratch buffer required for FC op. More... | |
| uint32_t | Cy_NNLite_DMAModeScratchBufSize (void) |
| Compute scratch buffer size needed for DMA mode API. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_TriggerDMAQueue (void) |
| Cy_NNLite_TriggerDMAQueue will trigger DMA transfer of Queued layer starting from first queued layer, callback function will be called after completion of all the Queued layer if valid callback function is passed in kernel context, API will work in blocking mode if callback function is NULL. More... | |
| uint32_t | Cy_NNLite_GetQueuedLayerCount (void) |
| Cy_NNLite_GetQueuedLayerCount will return count of queued layer for DMA. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_GetCurrDMAQueue (cy_nnlite_dma_queue_config_t *dmaQueue) |
| Cy_NNLite_GetCurrDMAQueue API will copy current dma queue in to dmaQueue pointer, valid dmaQueue pointer should be passed. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_RunDMAQueue (cy_nnlite_dma_queue_config_t *dmaQueue) |
| Cy_NNLite_RunDMAQueue API will Trigger DMA dmaQueue queue valid dmaQueue pointer should be passed, DMA queue should return from Cy_NNLite_GetCurrDMAQueue queue will be in runnable state if Cy_NNLite_GetCurrDMAQueue called after queue created in Kernel DMA API such as Cy_NNLite_AvgpoolDMA and get executed by calling Cy_NNLite_TriggerDMAQueue. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_SoftMax (const int8_t *inData, int8_t *outData, int8_t *expTempBuf, const cy_nn_dims_t *inoutDims, const cy_nn_pwise_unary_params_t *smParams) |
| Compute row-wise softmax of 2D input tensor. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_FFT (int32_t *ppBuf0, int32_t *ppBuf1, unsigned int fftStages) |
| Compute Q1.15 complex FFT. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_FFTDMA (int32_t *ppBuf0, int32_t *ppBuf1, unsigned int fftStages, void *scratchBuf) |
| Compute Q1.15 complex FFT DMA mode API API will configure DMA descriptor pointing nnlite MEMIO configuration structure. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_KernelInit (cy_kernel_config_t *kernelConfig) |
| Kernel Init API, initialize PDL driver and setup IRQ handler, setup function pointers from kernelConfig argument. More... | |
| cy_en_nnlite_status_t | Cy_NNLite_KernelDeInit (void) |
| Kernel Deinit API, de-initialize PDL driver and synchronization primitives. More... | |
| void Cy_NNLite_LeakyRelUPWLActivation | ( | float | alpha_scale, |
| float | unit_scale, | ||
| cy_nn_act_intrpl_param_t * | leakyRelU | ||
| ) |
Set PWL interpolation parameters for LeakyRElU activation.
[in] alpha_scale LeakyRelU scale for alpha parameter (may fold in a rescaling factor) [in] unit_scale LeakyRelU scale for unit gradient (may fold in a rescaling factor) [in] inParam Pointer to PWL activation struct to set for specified alpha
| cy_en_nnlite_status_t Cy_NNLite_Convolution | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| const int8_t * | filterData, | ||
| const int32_t * | biasData, | ||
| cy_nn_conv_params_t * | convParam, | ||
| cy_en_nnlite_fused_activation_t | actType, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
2D Convolution CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
filterData points to weights if sparse weight or non sparse based base on type of packing is used
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | filterData | filter pointer |
| [in] | biasData | bias pointer |
| [in] | convParam | convolution parameter structure pointer |
| [in] | actType | output activation type |
| [in] | intrplParam | interpolation param for PWL actType output activation |
| Refer | cy_en_nnlite_status_t |
2D Convolution CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
Kernel config structure should point to valid callback function. filterData points to weights if sparsityBaseAddr is NULL otherwise weights pointer will be derived from sparsityBaseAddr and filterData will not be used. Valid scratch buffer should be passed in convParam, scratch buffer will be used for transpose operation (transpose scratch buffer and transpose DMA descriptors)for per axis convolution implementation, size of scratch buffer should be derived by calling function Cy_NNLite_ConvolutionScratchBufSize. Scratch buffer can be freed after receiving completion callback of API.
[in] inputData activation buffer pointer
[in] outData output buffer pointer
[in] inputDims activation dimension pointer
[in] outpututDims output dimension pointer
[in] filterDims filter dimension pointer
[in] filterData filter pointer
[in] biasData bias pointer
[in] sparsityBaseAddr sparsity map base pointer
[in] convParam convolution parameter structure pointer
[in] actType output activation type
[in] intrplParam interpolation param for PWL output activation, null = nothing set
| cy_en_nnlite_status_t Cy_NNLite_ConvolutionDMA | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| const int8_t * | filterData, | ||
| const int32_t * | biasData, | ||
| cy_nn_conv_params_t * | convParam, | ||
| cy_en_nnlite_fused_activation_t | actType, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
2D Convolution DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in convParam, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
filterData points to weights if sparse weight or non sparse based base on type of packing is used
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | filterData | filter pointer |
| [in] | biasData | bias pointer |
| [in] | convParam | convolution parameter structure pointer |
| [in] | actType | output activation type |
| [in] | intrplParam | interpolation param for PWL actType output activation |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_DepthwiseConvolution | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| const int8_t * | filterData, | ||
| const int32_t * | biasData, | ||
| cy_nn_conv_params_t * | convParam, | ||
| cy_en_nnlite_fused_activation_t | actType, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
Depthwise Convolution CPU mode kernel API, API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function.
depth multiplier considers as additional stacked channels rather than separate filter channel = input_channel * depth.
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | filterData | filter pointer |
| [in] | biasData | bias pointer |
| [in] | convParam | convolution parameter structure pointer |
| [in] | actType | output activation type |
| [in] | intrplParam | interpolation param for PWL actType activation |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_DepthwiseConvolutionDMA | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| const int8_t * | filterData, | ||
| const int32_t * | biasData, | ||
| cy_nn_conv_params_t * | convParam, | ||
| cy_en_nnlite_fused_activation_t | actType, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
Depthwise DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in convParam, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue depth multiplier considers as additional stacked channels rather than separate filter channel = input_channel * depth
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | filterData | filter pointer |
| [in] | biasData | bias pointer |
| [in] | convParam | convolution parameter structure pointer |
| [in] | actType | output activation type |
| [in] | intrplParam | interpolation param for PWL actType activation |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_FullyConnected | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| const int8_t * | filterData, | ||
| const int32_t * | biasData, | ||
| cy_nn_fc_params_t * | fcParam, | ||
| cy_en_nnlite_fused_activation_t | actType, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
Fully connected CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode For case inputDims->dims[0] > 1,scratch buffer is required scratch buffer size in CPU should be calculated using Cy_NNLite_FC_ScratchBufSize API if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function.
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | filterData | filter data (weights or packed weights structure) pointer |
| [in] | biasData | bias pointer N.b. 64-bit per value fo r16-bit activations |
| [in] | fcParam | fully Connected parameter structure pointer |
| [in] | actType | output activation type |
| [in] | intrplParam | interpolation param for PWL actType activation |
| Refer | cy_en_nnlite_status_t |
Fully connected CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode For case inputDims->dims[0] > 1,scratch buffer is required scratch buffer size in CPU should be calculated using Cy_NNLite_FC_ScratchBufSize API if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function.
Kernel config structure should point to valid callback function. filterData points to weights If sparsityBaseAddr is NULL, otherwise weights pointer will be derived from sparsityBaseAddr and filterData will not be used. For case inputDims->dims[0] > 1,scratch buffer is required scratch buffer size in CPU should be calculated using Cy_NNLite_FC_ScratchBufSize API For DMA mode scratch is sum of Cy_NNLite_FC_ScratchBufSize & Cy_NNLite_DMAModeScratchBufSize
[in] inputData activation buffer pointer
[in] outData output buffer pointer
[in] inputDims activation dimension pointer
[in] outpututDims output dimension pointer
[in] filterDims filter dimension pointer
[in] filterData filter pointer
[in] biasData bias pointer
[in] sparsityBaseAddr sparsity map base pointer
[in] fcParam fully Connected parameter structure pointer
[in] actType output activation type
[in] intrplParam interpolation param for PWL output activation , null = nothing set
| cy_en_nnlite_status_t Cy_NNLite_FullyConnectedDMA | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| const int8_t * | filterData, | ||
| const int32_t * | biasData, | ||
| cy_nn_fc_params_t * | fcParam, | ||
| cy_en_nnlite_fused_activation_t | actType, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
Fully connected DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in fcParam, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize + Cy_NNLite_FC_ScratchBufSize. Cy_NNLite_FC_ScratchBufSize is required for case inputDims->dims[0] > 1 CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | filterData | filter data (weights or packed weights structure) pointer |
| [in] | biasData | bias pointer N.b. 64-bit per value fo r16-bit activations |
| [in] | fcParam | fully Connected parameter structure pointer |
| [in] | actType | output activation type |
| [in] | intrplParam | interpolation param for PWL actType activation |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Avgpool | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| cy_nn_pool_params_t * | avgpoolParam | ||
| ) |
Average pool CPU mode kernel API, API will configure nnlite.
and then start nnlite operation. API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | avgpoolParam | average pool parameter structure pointer |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_AvgpoolDMA | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| cy_nn_pool_params_t * | avgpoolParam | ||
| ) |
Average pool CPU mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in avgpoolParam, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | avgpoolParam | average pool parameter structure pointer |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Maxpool | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| cy_nn_pool_params_t * | poolParam | ||
| ) |
Max pool CPU mode kernel API, API will configure nnlite.
and then start nnlite operation. API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | poolParam | average pool parameter structure pointer |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_MaxpoolDMA | ( | const int8_t * | inputData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_dims_t * | filterDims, | ||
| cy_nn_pool_params_t * | poolParam | ||
| ) |
Max pool CPU mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in poolParam, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
| [in] | inputData | activation buffer pointer |
| [in] | outData | output buffer pointer |
| [in] | inputDims | activation dimension pointer |
| [in] | outputDims | output dimension pointer |
| [in] | filterDims | filter dimension pointer |
| [in] | poolParam | average pool parameter structure pointer |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Scaling_Setup | ( | cy_nn_scaling_t * | ss, |
| float | lhs_scale, | ||
| float | rhs_scale, | ||
| float | output_scale, | ||
| cy_en_nnlite_activation_size_t | in_size, | ||
| cy_en_nnlite_op_t | op_type, | ||
| cy_en_nnlite_fused_activation_t | act_type | ||
| ) |
Precomputation of NPU scaling factor settings for NPU binary operations.
| ss | Scaling factors NPU Operation |
| lhs_scale | Scale factor for "left hand side" input values |
| rhs_scale | Scale factor for "right hand side" input values |
| output_scale | Scale factor for final output values. |
| input_size | Bitwidth of (MAC) input values. |
| op_type | ALU Operation |
| act_type | Fused action function to be applied |
TODO Create some special-case "fast path" versions (e.g. for use inside LSTM)? Support per-filter and per-row setup for Conv and fully connected ops
| void Cy_NNLite_Scaling_Q_Setup | ( | cy_nn_scaling_t * | ss | ) |
Set scaling configuration to "no scaling" (fast)
| ss | Point to Scaling configuration to be |
| cy_en_nnlite_status_t Cy_NNLite_AddSubMul | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams, | ||
| cy_en_nnlite_op_t | op_type, | ||
| cy_en_nnlite_fused_activation_t | act_type | ||
| ) |
Generic binary op CPU mode kernel API, API will configure nnlite.
and then start nnlite operation. API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData.
Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | dimensions of rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| [in] | op_type | MAC-unit operating mode to configure |
| [in] | act_type | Activation function to configure |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_AddSubMulDMA | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams, | ||
| cy_en_nnlite_op_t | op_type, | ||
| cy_en_nnlite_fused_activation_t | act_type | ||
| ) |
Generic binary op CPU mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in pwParams, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData.
Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | dimensions of rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| [in] | op_type | MAC-unit operating mode to configure |
| [in] | act_type | Activation function to configure |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Add | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams | ||
| ) |
Pointwise addition operation.
Pointwise addition CPU mode kernel API, API will configure nnlite. and then start nnlite operation. API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData. Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| Refer | cy_en_nnlite_status_t |
Pointwise addition operation.
Delegates to Cy_NNLite_AddSub
| cy_en_nnlite_status_t Cy_NNLite_AddDMA | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams | ||
| ) |
Pointwise addition operation.
Pointwise addition DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. Valid scratch buffer should be passed in pwParams, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData. Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Sub | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams, | ||
| bool | left_from_right | ||
| ) |
Pointwise addition operation.
Pointwise addition CPU mode kernel API, API will configure nnlite and then start nnlite operation.API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData. Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| [in] | left_from_right | Compute rhsData - lhsData rather than lhsData - rhsData |
| Refer | cy_en_nnlite_status_t |
Pointwise addition operation.
Delegates to Cy_NNLite_AddSub
| cy_en_nnlite_status_t Cy_NNLite_SubDMA | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams, | ||
| bool | left_from_right | ||
| ) |
Pointwise addition operation.
Pointwise addition DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. Valid scratch buffer should be passed in pwParams, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData. Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| [in] | left_from_right | Compute rhsData - lhsData rather than lhsData - rhsData |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Mul | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams | ||
| ) |
multiplication
Pointwise multiplication CPU mode kernel API, API will configure nnlite and then start nnlite operation. API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData. Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| Refer | cy_en_nnlite_status_t |
multiplication
Delegates to Cy_NNLite_AddSubMul
| cy_en_nnlite_status_t Cy_NNLite_MulDMA | ( | const int8_t * | lhsData, |
| const int8_t * | rhsData, | ||
| int8_t * | outData, | ||
| const cy_nn_dims_t * | lhsDims, | ||
| const cy_nn_dims_t * | rhsOutDims, | ||
| const cy_nn_pwise_binary_params_t * | pwParams | ||
| ) |
Pointwise multiplication with simple broadcast.
Pointwise multiplication DMA mode kernel API, API will configure DMA descriptor pointing nnlite MEMIO configuration structure. Valid scratch buffer should be passed in pwParams, scratch buffer will be used for nnlite MEMIO configuration structure,size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
Limited broadcasting is supported. For rhsOuputDims [D_1,..,D_m,..,D_n] and lhsDims = [1,...,Dm,..Dn] lhsData is repeated for the [D_1,...,D_(m-1)] major coordinate positions in rhsData. Internally implemented as "depthwise" summation using 1x1 kernel.
| [in] | lhsData | lhs input tensor buffer pointer |
| [in] | rhsData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | lhsDims | dimensions of lhs argument (repeated if less elts than inputDims ) |
| [in] | rhsOutDims | rhs argument and output. |
| [in] | pwParams | Pointwise op params (lhs and output rescaling factors) |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Activation | ( | const int8_t * | inData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inoutDims, | ||
| const cy_nn_pwise_unary_params_t * | actParams, | ||
| cy_en_nnlite_fused_activation_t | act_type, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
Unfused Activation function CPU mode kernel API, API will configure nnlite and then start nnlite operation.
API will work in blocking mode if callback function in Kernel config structure is NULL, if valid callback function is passed in Kernel config, API will be non-blocking and callback function will be called after completion of layer, caller need to wait for callback function before calling another Kernel API, else error will be for other function
Internally implemented as "depthwise" operation on 1x1xC input
| [in] | inData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | inoutDims | rhs argument and output. |
| [in] | actParams | unfused activation op params (lhs and output rescaling factors) |
| [in] | act_type | Activation function to apply. |
| [in] | intrplParam | interpolation param for PWL output activation , null = nothing set |
| Refer | cy_en_nnlite_status_t |
Callback function from kernel config structure will be called after completion of layer. Kernel config structure should point to valid callback function.
Internally implemented as "depthwise" operation on 1x1xC input
| [in] | inData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | inoutDims | rhs argument and output. |
| [in] | actParams | unfused activation op params (lhs and output rescaling factors) |
| [in] | act_type | Activation function to apply. |
| [in] | intrplParam | interpolation param for PWL output activation , null = nothing set |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_ActivationDMA | ( | const int8_t * | inData, |
| int8_t * | outData, | ||
| const cy_nn_dims_t * | inoutDims, | ||
| const cy_nn_pwise_unary_params_t * | actParams, | ||
| cy_en_nnlite_fused_activation_t | act_type, | ||
| cy_nn_act_intrpl_param_t * | intrplParam | ||
| ) |
Unfused Activation function DMA mode kernel API,API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratch buffer should be passed in actParams, scratch buffer will be used for nnlite MEMIO configuration structure,size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
Internally implemented as "depthwise" operation on 1x1xC input
| [in] | inData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | inoutDims | rhs argument and output. |
| [in] | actParams | unfused activation op params (lhs and output rescaling factors) |
| [in] | act_type | Activation function to apply. |
| [in] | intrplParam | interpolation param for PWL output activation , null = nothing set |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_LayerNorm | ( | const int8_t * | inputData, |
| int8_t * | outputData, | ||
| const cy_nn_dims_t * | inputDims, | ||
| const cy_nn_dims_t * | outputDims, | ||
| const cy_nn_layernorm_params_t * | lnParams | ||
| ) |
Compute composite LayerNorm operation.
| inputData | Input tensor data |
| outputData | Output tensor data (MUST be distinct from inData) |
| inputDims | Input dimension pointer |
| outputDims | Output dimension pointer |
| lnParams | LayerNorm parameter structure pointer. |
| inData | Input tensor data |
| outData | Output tensor data (MUST be distinct from inData) |
| inputDims | Input dimension pointer |
| outputDims | Output dimension pointer |
| lnParam | LayerNorm parameter structure pointer. |
| cy_en_nnlite_status_t Cy_NNLite_Byte_Copy | ( | const int8_t * | inData, |
| int8_t * | outData, | ||
| uint32_t | count | ||
| ) |
Byte block copy using NNLite.
Internally implemented as "depthwise" operation on 1x1xC input
| [in] | inData | address start byte vector to be copied |
| [in] | outData | destination start address |
| [in] | count | Number of bytes to be copied |
| Refer | cy_en_nnlite_status_t |
Byte block copy using NNLite.
Callback function from kernel config structure will be called after completion of layer. Kernel config structure should point to valid callback function.
Internally implemented as "depthwise" operation on 1x1xC input
| [in] | inData | rhs input tensor pointer (elts repeated if less elts than lhs) |
| [in] | outData | output buffer pointer |
| [in] | inoutDims | rhs argument and output. |
| [in] | actParams | unfused activation op params (lhs and output rescaling factors) |
| [in] | act_type | Activation function to apply. |
| [in] | intrplParam | interpolation param for PWL output activation , null = nothing set |
| Refer | cy_en_nnlite_status_t |
Byte block copy using NNLite
Internally implemented as "depthwise" operation on 1x1xC input
| [in] | inData | address start byte vector to be copied |
| [in] | outData | destination start address |
| [in] | count | Number of bytes to be copied |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_Q31Reciprocal | ( | const uint32_t * | inData, |
| float * | outData, | ||
| const cy_nn_dims_t * | inoutDims | ||
| ) |
Float reciprocal of (sums of) unsigned Q.31 values CPU mode kernel API.
Internally implemented as summing WxC input over the minor axis to produce W outputs
API will configure nnlite and then start nnlite operation. Callback function from kernel config structure will be called after completion of layer. Kernel config structure should point to valid callback function.
| [in] | inData | rhs input tensor pointer |
| [in] | outData | output buffer pointer |
| [in] | inoutDims | input values |
| Refer | cy_en_nnlite_status_t |
Internally implemented summing over the minor dimensions to produce W outputs from WxC inputs
API will configure nnlite and then start nnlite operation. Callback function from kernel config structure will be called after completion of layer. Kernel config structure should point to valid callback function.
| [in] | inData | rhs input tensor pointer |
| [in] | outData | output buffer pointer |
| [in] | inoutDims | input values dimensions |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_LSTM_Int8 | ( | cy_nn_lstm_context * | scratch_buffers, |
| const int8_t * | input_data, | ||
| const cy_nn_lstm_dims * | lstm_dims, | ||
| const int8_t * | input_to_input_weights, | ||
| const int8_t * | input_to_forget_weights, | ||
| const int8_t * | input_to_cell_weights, | ||
| const int8_t * | input_to_output_weights, | ||
| const int8_t * | recurrent_to_input_weights, | ||
| const int8_t * | recurrent_to_forget_weights, | ||
| const int8_t * | recurrent_to_cell_weights, | ||
| const int8_t * | recurrent_to_output_weights, | ||
| const int8_t * | projection_weights, | ||
| const cy_nn_lstm_params * | lstm, | ||
| int8_t * | output_state, | ||
| int16_t * | cell_state, | ||
| int8_t * | output_data | ||
| ) |
LSTM unidirectional function with 8 bit input and output and 16 bit gate output Peephole connections, projection, clipping, combined input/forget gate and layer normalization are not supported.
| [in] | scratch_buffers | Struct containing scratch buffers Expected size for each scratch buffer is lstm_dims->num_batches * lstm_dims->num_outputs. |
| [in] | input_data | Pointer to input data |
| [in] | lstm_dims | LSTM input parameters related to dimensions |
| [in] | input_to_input_weights | Input to input weights |
| [in] | input_to_forget_weights | Input to forget weights |
| [in] | input_to_cell_weights | Input to cell weights |
| [in] | input_to_output_weights | Input to output weights |
| [in] | recurrent_to_input_weights | Recurrent to input weights |
| [in] | recurrent_to_forget_weights | Recurrent to forget weights |
| [in] | recurrent_to_cell_weights | Recurrent to cell weights |
| [in] | recurrent_to_output_weights | Recurrent to output weights |
| [in] | projection_weights | Projection weights. Not used. |
| [in] | lstm | LSTM parameters. See struct declaration |
| [in] | output_state | Pointer to (recurrent) output state |
| [in] | cell_state | Pointer to cell state |
| [in] | output_data | Pointer to output state |
1 Input to input weight can not be nullptr. Otherwise nullptr for combined input/forgat gate. 2 Cell weights are not used and should be nullptr. Otherwise needed for peephole connections. 3 Projection weight is not used and should be nullptr. Otherwise needed for projection.
| uint32_t Cy_NNLite_SoftMax_ScratchBufSize | ( | const cy_nn_dims_t * | inoutDims, |
| const cy_en_nnlite_activation_size_t | act_size | ||
| ) |
Compute scratch buffer size needed to compute row-wise softmax of 2D input tensor.
| [in] | inoutDims | Input tensors dimensions (rows, cols) |
| [in] | act_size | Data element size of input |
Compute scratch buffer size needed to compute row-wise softmax of 2D input tensor.
| inoutDims | Input dimensions of softmax operation |
| act_size | Size of input activation values |
| uint32_t Cy_NNLite_FC_ScratchBufSize | ( | const cy_nn_dims_t * | inDims, |
| const cy_nn_dims_t * | outDims | ||
| ) |
Compute size scratch buffer required for FC op.
| inDims | input dimensions of FC operation |
| outDims | Output dimensions of FC operation |
| uint32_t Cy_NNLite_DMAModeScratchBufSize | ( | void | ) |
Compute scratch buffer size needed for DMA mode API.
Compute scratch buffer size needed for DMA mode API.
| cy_en_nnlite_status_t Cy_NNLite_TriggerDMAQueue | ( | void | ) |
Cy_NNLite_TriggerDMAQueue will trigger DMA transfer of Queued layer starting from first queued layer, callback function will be called after completion of all the Queued layer if valid callback function is passed in kernel context, API will work in blocking mode if callback function is NULL.
| Refer | cy_en_nnlite_status_t |
| uint32_t Cy_NNLite_GetQueuedLayerCount | ( | void | ) |
Cy_NNLite_GetQueuedLayerCount will return count of queued layer for DMA.
| dmaQDepth | number of layers in DMA Queue |
| cy_en_nnlite_status_t Cy_NNLite_GetCurrDMAQueue | ( | cy_nnlite_dma_queue_config_t * | dmaQueue | ) |
Cy_NNLite_GetCurrDMAQueue API will copy current dma queue in to dmaQueue pointer, valid dmaQueue pointer should be passed.
To get the runnable queue Cy_NNLite_GetCurrDMAQueue should be called after the created in Kernel DMA API such as Cy_NNLite_AvgpoolDMA and get executed by calling Cy_NNLite_TriggerDMAQueue
| [in] | dmaQueue | dma queue pointer in which dma queue will be copied |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_RunDMAQueue | ( | cy_nnlite_dma_queue_config_t * | dmaQueue | ) |
Cy_NNLite_RunDMAQueue API will Trigger DMA dmaQueue queue valid dmaQueue pointer should be passed, DMA queue should return from Cy_NNLite_GetCurrDMAQueue queue will be in runnable state if Cy_NNLite_GetCurrDMAQueue called after queue created in Kernel DMA API such as Cy_NNLite_AvgpoolDMA and get executed by calling Cy_NNLite_TriggerDMAQueue.
API will work in blocking mode if callback function is passed as NULL in kernel context
| [in] | dmaQueue | dma queue pointer in which dma queue will be copied |
| Refer | cy_en_nnlite_status_t |
| cy_en_nnlite_status_t Cy_NNLite_SoftMax | ( | const int8_t * | inData, |
| int8_t * | outData, | ||
| int8_t * | scratchBuf, | ||
| const cy_nn_dims_t * | inoutDims, | ||
| const cy_nn_pwise_unary_params_t * | smParams | ||
| ) |
Compute row-wise softmax of 2D input tensor.
| inData | |
| outData | |
| expTempBuf | |
| inoutDims | |
| smParams |
Compute row-wise softmax of 2D input tensor.
| inData | Input tensor data |
| outData | Output tensor data (MUST be distinct from inData) |
| scratchBuf | Scratch buffer for intermediate values (required size returned by Cy_NNLite_SoftMax_ScratchBufSize) (should be word-aligned for performance) |
| inoutDims | Dimensions of 2D input tensors (Set dim[0]==1 for 1D case) |
| smParams | Input/output tensor quantization parameters bitwidths etc. |
| cy_en_nnlite_status_t Cy_NNLite_FFT | ( | int32_t * | ppBuf0, |
| int32_t * | ppBuf1, | ||
| unsigned int | fftStages | ||
| ) |
Compute Q1.15 complex FFT.
NNLite implements Decimation-in-Time Radix-2 FFT for 16 bit input buffers should be allocated for 32 bit, buffers will be used in ping-pong mode final output will be in buf0 for even stage for odd stage buf1 will have final output
| ppBuf0 | Input / ping-pong buffer 0, Output (even stages/# values) |
| ppBuf1 | ping-pong buffer 1, Output (odd stages/# values) |
| fftStages | log_2(FFT length) |
| cy_en_nnlite_status_t Cy_NNLite_FFTDMA | ( | int32_t * | ppBuf0, |
| int32_t * | ppBuf1, | ||
| unsigned int | fftStages, | ||
| void * | scratchBuf | ||
| ) |
Compute Q1.15 complex FFT DMA mode API API will configure DMA descriptor pointing nnlite MEMIO configuration structure.
Valid scratchBuf should be passed in pParam, scratch buffer will be used for nnlite MEMIO configuration structure, size of scratch buffer should be value return from Cy_NNLite_ScratchBufSize. CY_NNLITE_OP_QUEUED will be the return value on success After queuing kernel, DMA needs to be triggered by calling API Cy_TriggerNNLiteDMAQueue
NNLite implements Decimation-in-Time Radix-2 FFT
| ppBuf0 | Input / ping-pong buffer 0, Output (even stages/# values) |
| ppBuf1 | ping-pong buffer 1, Output (odd stages/# values) |
| fftStages | log_2(FFT length) |
| scratchBuf | Scratch buffer for DMA mode |
| cy_en_nnlite_status_t Cy_NNLite_KernelInit | ( | cy_kernel_config_t * | kernelConfig | ) |
Kernel Init API, initialize PDL driver and setup IRQ handler, setup function pointers from kernelConfig argument.
This API needs to be called before calling any other kernel API
| [in] | kernelConfig | kernel configuration structure |
| cy_en_nnlite_status_t |
Kernel Init API, initialize PDL driver and setup IRQ handler, setup function pointers from kernelConfig argument.
KernelConfig should have valid pointer for Mutex variable and function pointers for mutexCreate, mutexDelete, mutexLock, mutexUnlock and and should have valid pointers for Semaphore variable and function pointers for SemCreate, SemDelete, SemWait and SemGive for synchronization primitives. This API will allocate mutex and semaphore by calling mutexCreate and SemCreate, and will use them in successive call to other kernel public API's. API needs to be called before calling any other kernel API, If any of the pointers in KernelConfig is not valid API will return error code ,return value of API should be check to confirm successful initialization.
[in] kernelConfig kernel function pointers configuration structure
| cy_en_nnlite_status_t Cy_NNLite_KernelDeInit | ( | void | ) |
Kernel Deinit API, de-initialize PDL driver and synchronization primitives.
needs re initialization after this API is called. Should be called only at end of program
| cy_en_nnlite_status_t |
needs re initialization after this API is called. Should be called only at end of program