| 651 | } |
| 652 | |
| 653 | Status CpuGemmConv2d::has_opt_impl(arm_compute::WeightFormat &expected_weight_format, |
| 654 | const ITensorInfo *src, |
| 655 | const ITensorInfo *weights, |
| 656 | const ITensorInfo *biases, |
| 657 | const ITensorInfo *dst, |
| 658 | const PadStrideInfo &conv_info, |
| 659 | const WeightsInfo &weights_info, |
| 660 | const Size2D &dilation, |
| 661 | const ActivationLayerInfo &act_info, |
| 662 | const bool enable_fast_math) |
| 663 | { |
| 664 | const DataLayout data_layout = src->data_layout(); |
| 665 | const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); |
| 666 | const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); |
| 667 | const unsigned int kernel_width = weights->dimension(idx_width); |
| 668 | const unsigned int kernel_height = weights->dimension(idx_height); |
| 669 | unsigned int conv_w = 0; |
| 670 | unsigned int conv_h = 0; |
| 671 | std::tie(conv_w, conv_h) = scaled_dimensions(src->dimension(idx_width), src->dimension(idx_height), kernel_width, |
| 672 | kernel_height, conv_info, dilation); |
| 673 | |
| 674 | const CpuGemmConv2d::SkipInfo skip_info = |
| 675 | CpuGemmConv2d::skip_im_col_info(src, weights, conv_info, dilation, act_info); |
| 676 | |
| 677 | const bool skip_im2col = skip_info.skip_im2col; |
| 678 | const bool skip_col2im = skip_info.skip_col2im; |
| 679 | const unsigned int gemm_3d_depth = skip_col2im ? conv_h : 0; |
| 680 | const bool fixed_format = weights_info.weight_format() != arm_compute::WeightFormat::UNSPECIFIED; |
| 681 | |
| 682 | /** @section note_CpuGemmConv2d_weight_use_in_has_opt_impl Which weights tensor should we use for has_opt_impl |
| 683 | * |
| 684 | * For the pretranspose_B flag, this shares a similar problem and thus the same decision as that of |
| 685 | * @ref note_CpuGemmConv2d_weight_use_in_configure |
| 686 | * |
| 687 | * But for the weights, we shall always use the original instead of reshaped weights here |
| 688 | */ |
| 689 | const GEMMInfo gemm_info = GEMMInfo(false, false, true /* Reshape weights only for the first run */, gemm_3d_depth, |
| 690 | skip_im2col /* Reinterpret the input as 3D if im2col is skipped */, false, |
| 691 | GEMMLowpOutputStageInfo(), false, enable_fast_math, false, act_info, |
| 692 | fixed_format, weights_info.weight_format(), true /* pretranspose_B */); |
| 693 | |
| 694 | return CpuGemm::has_opt_impl(expected_weight_format, src, weights, biases, dst, gemm_info); |
| 695 | } |
| 696 | |
| 697 | Status CpuGemmConv2d::validate(const ITensorInfo *src, |
| 698 | const ITensorInfo *weights, |
nothing calls this directly
no test coverage detected