| 77 | } // namespace |
| 78 | |
| 79 | void CpuDepthwiseConv2d::CpuDepthwiseConv2dOptimizedInternal::configure(ITensorInfo *src, |
| 80 | const ITensorInfo *weights, |
| 81 | const ITensorInfo *biases, |
| 82 | ITensorInfo *dst, |
| 83 | const ConvolutionInfo &info) |
| 84 | { |
| 85 | ARM_COMPUTE_ERROR_ON_NULLPTR(src, weights, dst); |
| 86 | // Perform validation step |
| 87 | ARM_COMPUTE_ERROR_THROW_ON( |
| 88 | CpuDepthwiseConv2dOptimizedInternal::validate(src, weights, (biases == nullptr) ? nullptr : biases, dst, info)); |
| 89 | |
| 90 | _is_quantized = is_data_type_quantized_asymmetric(src->data_type()); |
| 91 | _has_bias = biases != nullptr; |
| 92 | _is_nchw = src->data_layout() == DataLayout::NCHW; |
| 93 | _permute = _is_nchw; |
| 94 | _is_prepared = false; |
| 95 | _are_weights_const = weights->are_values_constant(); |
| 96 | |
| 97 | // Configure pipeline |
| 98 | _is_activationlayer_enabled = |
| 99 | info.act_info.enabled() && !CpuDepthwiseConv2dAssemblyDispatch::is_activation_supported(info.act_info); |
| 100 | |
| 101 | _dwc_optimized_func = std::make_unique<CpuDepthwiseConv2dAssemblyDispatch>(); |
| 102 | if (_is_nchw) |
| 103 | { |
| 104 | _permute_input = std::make_unique<cpu::CpuPermute>(); |
| 105 | _permute_weights = std::make_unique<cpu::CpuPermute>(); |
| 106 | _permute_output = std::make_unique<cpu::CpuPermute>(); |
| 107 | |
| 108 | auto input_perm = std::make_unique<TensorInfo>(); |
| 109 | auto weights_perm = std::make_unique<TensorInfo>(); |
| 110 | auto output_perm = std::make_unique<TensorInfo>(); |
| 111 | |
| 112 | // Configure the function to transform the input tensor from NCHW -> NHWC |
| 113 | _permute_input->configure(src, input_perm.get(), PermutationVector(2U, 0U, 1U)); |
| 114 | input_perm->set_data_layout(DataLayout::NHWC); |
| 115 | |
| 116 | // Configure the function to transform the weights tensor from IHW -> HWI |
| 117 | _permute_weights->configure(weights, weights_perm.get(), PermutationVector(2U, 0U, 1U)); |
| 118 | weights_perm->set_data_layout(DataLayout::NHWC); |
| 119 | |
| 120 | output_perm->set_data_layout(DataLayout::NHWC); |
| 121 | output_perm->set_quantization_info(dst->quantization_info()); |
| 122 | |
| 123 | // Configure optimized depthwise |
| 124 | _dwc_optimized_func->configure(input_perm.get(), weights_perm.get(), biases, output_perm.get(), info); |
| 125 | |
| 126 | // Configure the function to transform the convoluted output to ACL's native ordering format NCHW |
| 127 | output_perm->set_data_layout(DataLayout::NHWC); |
| 128 | _permute_output->configure(output_perm.get(), dst, PermutationVector(1U, 2U, 0U)); |
| 129 | } |
| 130 | else |
| 131 | { |
| 132 | _dwc_optimized_func->configure(src, weights, biases, dst, info); |
| 133 | } |
| 134 | |
| 135 | // Configure activation |
| 136 | if (_is_activationlayer_enabled) |
nothing calls this directly
no test coverage detected