| 179 | |
| 180 | template <KernelType kernel_type> |
| 181 | void EvalFloat(TfLiteContext* context, TfLiteNode* node, |
| 182 | TfLiteDepthwiseConvParams* params, OpData* data, |
| 183 | const TfLiteTensor* input, const TfLiteTensor* filter, |
| 184 | const TfLiteTensor* bias, TfLiteTensor* output) { |
| 185 | float output_activation_min, output_activation_max; |
| 186 | CalculateActivationRange(params->activation, &output_activation_min, |
| 187 | &output_activation_max); |
| 188 | |
| 189 | DepthwiseParams op_params; |
| 190 | op_params.padding_type = PaddingType::kSame; |
| 191 | op_params.padding_values.width = data->padding.width; |
| 192 | op_params.padding_values.height = data->padding.height; |
| 193 | op_params.stride_width = params->stride_width; |
| 194 | op_params.stride_height = params->stride_height; |
| 195 | op_params.dilation_width_factor = params->dilation_width_factor; |
| 196 | op_params.dilation_height_factor = params->dilation_height_factor; |
| 197 | op_params.depth_multiplier = params->depth_multiplier; |
| 198 | op_params.float_activation_min = output_activation_min; |
| 199 | op_params.float_activation_max = output_activation_max; |
| 200 | if (kernel_type == kReference) { |
| 201 | reference_ops::DepthwiseConv( |
| 202 | op_params, GetTensorShape(input), GetTensorData<float>(input), |
| 203 | GetTensorShape(filter), GetTensorData<float>(filter), |
| 204 | GetTensorShape(bias), GetTensorData<float>(bias), |
| 205 | GetTensorShape(output), GetTensorData<float>(output)); |
| 206 | } else { |
| 207 | optimized_ops::DepthwiseConv<float, float>( |
| 208 | op_params, GetTensorShape(input), GetTensorData<float>(input), |
| 209 | GetTensorShape(filter), GetTensorData<float>(filter), |
| 210 | GetTensorShape(bias), GetTensorData<float>(bias), |
| 211 | GetTensorShape(output), GetTensorData<float>(output), |
| 212 | CpuBackendContext::GetFromContext(context)); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | template <KernelType kernel_type> |
| 217 | void EvalQuantized(TfLiteContext* context, TfLiteNode* node, |
nothing calls this directly
no test coverage detected