|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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; |
|
|
}; |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|