| 133 | }; |
| 134 | |
| 135 | inline void Conv(const Eigen::ThreadPoolDevice& device, |
| 136 | const ConvParams& params, const RuntimeShape& input_shape, |
| 137 | const float* input_data, const RuntimeShape& filter_shape, |
| 138 | const float* filter_data, const RuntimeShape& bias_shape, |
| 139 | const float* bias_data, const RuntimeShape& output_shape, |
| 140 | float* output_data, const RuntimeShape& im2col_shape, |
| 141 | float* im2col_data) { |
| 142 | // im2col data should not be generated for the multi-thread supporting case. |
| 143 | TFLITE_DCHECK(!im2col_data); |
| 144 | (void)im2col_shape; |
| 145 | const int stride_width = params.stride_width; |
| 146 | const int stride_height = params.stride_height; |
| 147 | const PaddingType padding = params.padding_type; |
| 148 | const int pad_width = params.padding_values.width; |
| 149 | const int pad_height = params.padding_values.height; |
| 150 | const float output_activation_min = params.float_activation_min; |
| 151 | const float output_activation_max = params.float_activation_max; |
| 152 | TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); |
| 153 | TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); |
| 154 | TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); |
| 155 | |
| 156 | const int batches = MatchingDim(input_shape, 0, output_shape, 0); |
| 157 | const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); |
| 158 | const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); |
| 159 | const int input_height = input_shape.Dims(1); |
| 160 | const int input_width = input_shape.Dims(2); |
| 161 | const int filter_height = filter_shape.Dims(1); |
| 162 | const int filter_width = filter_shape.Dims(2); |
| 163 | const int output_height = output_shape.Dims(1); |
| 164 | const int output_width = output_shape.Dims(2); |
| 165 | EigenTensorConvFunctor<float> conv_functor; |
| 166 | conv_functor(device, input_data, batches, input_height, input_width, |
| 167 | input_depth, filter_data, filter_height, filter_width, |
| 168 | output_depth, stride_height, stride_width, pad_height, pad_width, |
| 169 | padding, output_data, output_height, output_width); |
| 170 | |
| 171 | optimized_ops::AddBiasAndEvalActivationFunction( |
| 172 | output_activation_min, output_activation_max, bias_shape, bias_data, |
| 173 | output_shape, output_data); |
| 174 | } |
| 175 | |
| 176 | } // namespace multithreaded_ops |
| 177 | } // namespace tflite |
nothing calls this directly
no test coverage detected