| 171 | } |
| 172 | |
| 173 | CpuGemmConv2d::SkipInfo CpuGemmConv2d::skip_im_col_info(const ITensorInfo *src, |
| 174 | const ITensorInfo *weights, |
| 175 | const PadStrideInfo &conv_info, |
| 176 | const Size2D &dilation, |
| 177 | const ActivationLayerInfo &act_info) |
| 178 | { |
| 179 | const DataLayout data_layout = src->data_layout(); |
| 180 | const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); |
| 181 | const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); |
| 182 | const unsigned int kernel_width = weights->dimension(idx_width); |
| 183 | const unsigned int kernel_height = weights->dimension(idx_height); |
| 184 | unsigned int conv_w = 0; |
| 185 | unsigned int conv_h = 0; |
| 186 | std::tie(conv_w, conv_h) = scaled_dimensions(src->dimension(idx_width), src->dimension(idx_height), kernel_width, |
| 187 | kernel_height, conv_info, dilation); |
| 188 | |
| 189 | const bool skip_im2col = (data_layout == DataLayout::NHWC && kernel_width == 1 && kernel_height == 1 && |
| 190 | conv_info.stride().first == 1 && conv_info.stride().second == 1) && |
| 191 | !conv_info.has_padding(); |
| 192 | |
| 193 | if (skip_im2col) |
| 194 | { |
| 195 | const bool skip_col2im = |
| 196 | (data_layout == DataLayout::NHWC && |
| 197 | (bool(CpuGemmConv2d::validate_gemm3d(src, weights, act_info, conv_h, /*skip_im2col*/ true)))); |
| 198 | if (skip_col2im) |
| 199 | { |
| 200 | return {true, true}; |
| 201 | } |
| 202 | } |
| 203 | else |
| 204 | { |
| 205 | const bool skip_col2im = |
| 206 | (data_layout == DataLayout::NHWC && |
| 207 | (bool(CpuGemmConv2d::validate_gemm3d(src, weights, act_info, conv_h, /*skip_im2col*/ false)))); |
| 208 | if (skip_col2im) |
| 209 | { |
| 210 | return {false, true}; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | // Default case when we cannot reinterpret the input and output as 3D. |
| 215 | return {false, false}; |
| 216 | } |
| 217 | |
| 218 | CpuGemmConv2d::CpuGemmConv2d() |
| 219 | : _weights_reshape(nullptr), |
nothing calls this directly
no test coverage detected