| 196 | |
| 197 | template <typename T> |
| 198 | void Im2col(const ConvParams& params, int kheight, int kwidth, uint8 zero_byte, |
| 199 | const RuntimeShape& input_shape, const T* input_data, |
| 200 | const RuntimeShape& output_shape, T* output_data) { |
| 201 | gemmlowp::ScopedProfilingLabel label("Im2col"); |
| 202 | const int stride_width = params.stride_width; |
| 203 | const int stride_height = params.stride_height; |
| 204 | const int pad_width = params.padding_values.width; |
| 205 | const int pad_height = params.padding_values.height; |
| 206 | TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); |
| 207 | TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); |
| 208 | |
| 209 | const int batches = MatchingDim(input_shape, 0, output_shape, 0); |
| 210 | const int input_depth = input_shape.Dims(3); |
| 211 | const int input_width = input_shape.Dims(2); |
| 212 | const int input_height = input_shape.Dims(1); |
| 213 | const int output_depth = output_shape.Dims(3); |
| 214 | const int output_width = output_shape.Dims(2); |
| 215 | const int output_height = output_shape.Dims(1); |
| 216 | |
| 217 | int buffer_id = 0; |
| 218 | // Loop over the output nodes. |
| 219 | for (int b = 0; b < batches; ++b) { |
| 220 | for (int h = 0; h < output_height; ++h) { |
| 221 | for (int w = 0; w < output_width; ++w) { |
| 222 | ExtractPatchIntoBufferColumn( |
| 223 | input_shape, w, h, b, kheight, kwidth, stride_width, stride_height, |
| 224 | pad_width, pad_height, input_width, input_height, input_depth, |
| 225 | output_depth, buffer_id, input_data, output_data, zero_byte); |
| 226 | ++buffer_id; |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | } // namespace optimized_ops |
| 233 | } // namespace tflite |
no test coverage detected