1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_LITE_MICRO_KERNELS_DEPTHWISE_CONV_H_ 17 #define TENSORFLOW_LITE_MICRO_KERNELS_DEPTHWISE_CONV_H_ 18 19 #include <cstdint> 20 21 #include "tensorflow/lite/c/builtin_op_data.h" 22 #include "tensorflow/lite/c/common.h" 23 #include "tensorflow/lite/kernels/internal/types.h" 24 #include "tensorflow/lite/micro/kernels/conv.h" 25 26 namespace tflite { 27 28 extern const int kDepthwiseConvInputTensor; 29 extern const int kDepthwiseConvWeightsTensor; 30 extern const int kDepthwiseConvBiasTensor; 31 extern const int kDepthwiseConvOutputTensor; 32 extern const int kDepthwiseConvQuantizedDimension; 33 34 // Returns a DepthwiseParams struct with all the parameters needed for a 35 // float computation. 36 DepthwiseParams DepthwiseConvParamsFloat( 37 const TfLiteDepthwiseConvParams& params, const OpDataConv& data); 38 39 // Returns a DepthwiseParams struct with all the parameters needed for a 40 // quantized computation. 41 DepthwiseParams DepthwiseConvParamsQuantized( 42 const TfLiteDepthwiseConvParams& params, const OpDataConv& data); 43 44 TfLiteStatus CalculateOpDataDepthwiseConv( 45 TfLiteContext* context, TfLiteNode* node, 46 const TfLiteDepthwiseConvParams& params, int width, int height, 47 int filter_width, int filter_height, int out_width, int out_height, 48 const TfLiteType data_type, OpDataConv* data); 49 50 TfLiteStatus DepthwiseConvPrepare(TfLiteContext* context, TfLiteNode* node); 51 52 } // namespace tflite 53 54 #endif // TENSORFLOW_LITE_MICRO_KERNELS_DEPTHWISE_CONV_H_ 55