MMALIB_CNN_convolve_col_smallNo_highPrecision requires that the weights be preprocessed into a specific arrangement. The functions in this module perform that preprocessing and other associated tasks.
This preprocessing can be done offline (more efficient) or at runtime. The input weights are assumed to be stored as illustrated in this Python pseudocode:
print('{')
for g in range(0, numGroupsPerKernel):
for no in range(0, No):
for ni in range(0, Ni):
for row in range(0, Fr):
for col in range(0, Fc):
print("{:>3}, ".format(pWeights[no + g*No, ni, row, col]), end='')
print('')
print('};')
◆ MMALIB_CNN_convolve_col_smallNo_highPrecision_reorderWeights_Args
◆ MMALIB_reorder_weights_highPrecision_operation_e
◆ MMALIB_CNN_convolve_col_smallNo_highPrecision_reorderWeights_getMemorySize()
This function returns the amount of memory that needs to be allocated for reordered kernel coefficients needed to support MMALIB_CNN_convolve_col_smallNo_highPrecision.
- Parameters
-
[in] | pArgs | : Pointer to the structure containing the required dimensional information |
- Returns
- Number of bytes required to store the reordered kernel coefficients
◆ MMALIB_CNN_convolve_col_smallNo_highPrecision_reorderWeights_fillBufParams()
This function populates a structure of dimensional information about the reordered coefficients buffer from a MMALIB_CNN_convolve_col_smallNo_highPrecision_reorderWeights_Args structure.
- Parameters
-
[in] | pArgs | : Pointer to the structure containing the required dimensional information |
[out] | pReorderedWeights_addr | : Pointer to structure containing dimensional information of the reordered weights buffer. |
- Returns
- Status of success or error with error codes, refer to MMALIB_STATUS.
◆ MMALIB_CNN_convolve_col_smallNo_highPrecision_reorderWeights_exec()
This function takes a set of weights and biases (optional) and reorders the coefficients for improved efficiency when computing column flow convolution.
The function can receive the bias values either embedded in the kernel weights a priori, or as a separate vector. If the weights are already embedded in pWeights, then the function must be called with pBias == NULL.
- Parameters
-
[in] | operation | : Desired reordering configuration, arguments are of type MMALIB_reorder_weights_highPrecision_operation_e HIGHPRECISION_REORDERWEIGHTS_AND_BIAS = reorder weights and bias values simultaneously HIGHPRECISION_REORDERWEIGHTS = reorder weights, leaving space for bias values to be added later HIGHPRECISION_REORDERBIAS = assume weights are already present, add-in bias values |
[in] | pArgs | : Pointer to argument structure containing necessary parameters for reordering weights |
[in] | pWeights_addr | : Pointer to structure containing dimensional information of the naturally ordered weights buffer. |
[in] | pWeights[] | : Pointer to buffer holding naturally ordered convolution weights |
[in] | pBias_addr | : Pointer to structure containing dimensional information of the bias values buffer. |
[in] | pBias[] | : Pointer to buffer holding bias values |
[in] | pReorderedWeights_addr | : Pointer to structure containing dimensional information of the reordered weights buffer. |
[out] | pReorderedWeights[] | : Pointer to buffer holding the reordered weights |
- Returns
- Status of success or error with error codes, refer to MMALIB_STATUS.
- Assumptions:
- pBias == NULL if the bias values are already stored with weights in pWeights in HIGHPRECISION_REORDERWEIGHTS_AND_BIAS mode
- Performance Considerations:
- This function may either be called during the processing flow, or offline whenever the weights are known.