| 155 | CpuFullyConnected::~CpuFullyConnected() = default; |
| 156 | |
| 157 | void CpuFullyConnected::configure_mm(const ITensorInfo *src, |
| 158 | const ITensorInfo *weights, |
| 159 | const ITensorInfo *biases, |
| 160 | ITensorInfo *dst, |
| 161 | const ActivationLayerInfo &act) |
| 162 | { |
| 163 | if (_is_quantized_asymmetric) |
| 164 | { |
| 165 | // Since we need negative offsets for computing convolution, we need to change QuantizationInfo() |
| 166 | // Extract and negate src and weights offset |
| 167 | const QuantizationInfo src_quantization_info(src->quantization_info().uniform().scale, |
| 168 | -src->quantization_info().uniform().offset); |
| 169 | const QuantizationInfo weights_quantization_info(weights->quantization_info().uniform().scale, |
| 170 | -weights->quantization_info().uniform().offset); |
| 171 | |
| 172 | TensorInfo src_info = src->clone()->set_quantization_info(src_quantization_info); |
| 173 | TensorInfo weights_info = weights->clone()->set_quantization_info(weights_quantization_info); |
| 174 | |
| 175 | // Configure gemmlowp function and output stage for asymmetric quantized types |
| 176 | GEMMLowpOutputStageInfo gemmlowp_output_stage_info; |
| 177 | const Status status = |
| 178 | get_gemmlowp_output_stage_info(&src_info, &weights_info, dst, act, gemmlowp_output_stage_info); |
| 179 | ARM_COMPUTE_ERROR_ON(status.error_code() != ErrorCode::OK); |
| 180 | |
| 181 | GEMMInfo gemm_info; |
| 182 | gemm_info.set_gemmlowp_output_stage(gemmlowp_output_stage_info); |
| 183 | gemm_info.set_activation_info(act); |
| 184 | gemm_info.set_fast_math(_enable_fast_math); |
| 185 | _mm_gemmlowp = std::make_unique<CpuGemmLowpMatrixMultiplyCore>(); |
| 186 | _mm_gemmlowp->configure(&src_info, &weights_info, biases, dst, gemm_info); |
| 187 | } |
| 188 | else |
| 189 | { |
| 190 | // Configure matrix multiply kernel |
| 191 | GEMMInfo gemm_info; |
| 192 | gemm_info.set_activation_info(act); |
| 193 | gemm_info.set_fast_math(_enable_fast_math); |
| 194 | gemm_info.set_fixed_format(_fixed_format); |
| 195 | gemm_info.set_weight_format(_weight_format); |
| 196 | _mm_gemm = std::make_unique<CpuGemm>(); |
| 197 | _mm_gemm->configure(src, weights, biases, dst, 1.f, 1.0f, gemm_info); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | void CpuFullyConnected::configure_conv_fc(const ITensorInfo *src, |
| 202 | const ITensorInfo *weights, |
nothing calls this directly
no test coverage detected