Function arm_fully_connected_wrapper_s16¶
Defined in File arm_nnfunctions.h
Function Documentation¶
-
arm_cmsis_nn_status arm_fully_connected_wrapper_s16(const cmsis_nn_context *ctx, const cmsis_nn_fc_params *fc_params, const cmsis_nn_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int16_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int64_t *bias_data, const cmsis_nn_dims *output_dims, int16_t *output_data)¶
s16 Fully Connected layer wrapper function
Supported framework: TensorFlow Lite
- Parameters:
ctx – [inout] Scratch buffer, whose use depends on the route taken. Unlike the s8 wrapper, no precomputed kernel sums are expected on either route, and clearing the buffer is harmless. When quant_params->is_per_channel is set, the context is passed to arm_fully_connected_per_channel_s16(), which writes it before reading it, on every build: it is filled there with one reduced int32 multiplier per output channel, so the caller supplies the storage only. On that route ctx or ctx->buf being NULL is reported as ARM_CMSIS_NN_ARG_ERROR, as is a non-zero ctx->size smaller than filter_dims->c * sizeof(int32_t); a ctx->size of 0 is treated as undeclared and is not checked. Size it with arm_fully_connected_per_channel_s16_get_buffer_size(). Otherwise the context goes to arm_fully_connected_s16(), which currently ignores it entirely, so { NULL, 0 } is accepted on that route. A caller that does not know the route in advance should size for the per-channel case, since arm_fully_connected_s16_get_buffer_size() returns 0. None of this is a guarantee about future versions. The caller is expected to clear the buffer afterwards, if applicable, for security reasons.
fc_params – [in] Fully Connected layer parameters. Range of fc_params->input_offset : 0 fc_params->filter_offset : 0 Range of fc_params->output_offset : 0
quant_params – [in] Per-channel or per-tensor quantization info. Check struct defintion for details. It contains the multiplier and shift value(s) to be applied to each output channel
input_dims – [in] Input (activation) tensor dimensions. Format: [N, H, W, C_IN] Input dimension is taken as Nx(H * W * C_IN)
input_data – [in] Input (activation) data pointer. Data type: int16
filter_dims – [in] Two dimensional filter dimensions. Format: [N, C] N : accumulation depth and equals (H * W * C_IN) from input_dims C : output depth and equals C_OUT in output_dims H & W : Not used
filter_data – [in] Filter data pointer. Data type: int8
bias_dims – [in] Bias tensor dimensions. Format: [C_OUT] N, H, W : Not used
bias_data – [in] Bias data pointer. Data type: int64
output_dims – [in] Output tensor dimensions. Format: [N, C_OUT] N : Batches C_OUT : Output depth H & W : Not used.
output_data – [inout] Output data pointer. Data type: int16
- Returns:
The function returns either
ARM_CMSIS_NN_ARG_ERRORif argument constraints fail. or,ARM_CMSIS_NN_SUCCESSon successful completion.