| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef TENSORFLOW_LITE_MICRO_KERNELS_CONV_H_ |
| #define TENSORFLOW_LITE_MICRO_KERNELS_CONV_H_ |
|
|
| #include <cstdint> |
|
|
| #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" |
| #include "edge-impulse-sdk/tensorflow/lite/c/common.h" |
| #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" |
|
|
| namespace tflite { |
|
|
| struct OpDataConv { |
| TfLitePaddingValues padding; |
|
|
| |
| int32_t input_zero_point; |
| int32_t filter_zero_point; |
| int32_t output_zero_point; |
|
|
| |
| |
| int32_t output_multiplier; |
| int output_shift; |
|
|
| |
| int32_t* per_channel_output_multiplier; |
| int32_t* per_channel_output_shift; |
|
|
| |
| |
| int32_t output_activation_min; |
| int32_t output_activation_max; |
|
|
| |
| |
| int filter_buffer_index; |
| }; |
|
|
| extern const int kConvInputTensor; |
| extern const int kConvWeightsTensor; |
| extern const int kConvBiasTensor; |
| extern const int kConvOutputTensor; |
| extern const int kConvQuantizedDimension; |
|
|
| |
| |
| ConvParams ConvParamsFloat(const TfLiteConvParams& params, |
| const OpDataConv& data); |
|
|
| |
| |
| ConvParams ConvParamsQuantized(const TfLiteConvParams& params, |
| const OpDataConv& data); |
|
|
| TfLiteStatus CalculateOpDataConv(TfLiteContext* context, TfLiteNode* node, |
| const TfLiteConvParams& params, int width, |
| int height, int filter_width, |
| int filter_height, int out_width, |
| int out_height, const TfLiteType data_type, |
| OpDataConv* data); |
|
|
| TfLiteStatus ConvPrepare(TfLiteContext* context, TfLiteNode* node); |
|
|
| |
| |
| |
| TfLiteRegistration Register_CONV_2D(); |
|
|
| #if defined(XTENSA) |
| |
| |
| |
| TfLiteRegistration Register_CONV_2D_INT8REF(); |
| #else |
| inline TfLiteRegistration Register_CONV_2D_INT8REF() { |
| return Register_CONV_2D(); |
| } |
| #endif |
|
|
| #if defined(CMSIS_NN) |
| |
| |
| |
| TfLiteRegistration Register_CONV_2D_INT8(); |
|
|
| |
| |
| |
| TfLiteRegistration Register_CONV_2D_INT16(); |
|
|
| #else |
| inline TfLiteRegistration Register_CONV_2D_INT8() { return Register_CONV_2D(); } |
|
|
| inline TfLiteRegistration Register_CONV_2D_INT16() { |
| return Register_CONV_2D(); |
| } |
| #endif |
|
|
| } |
|
|
| #endif |
|
|