| 85 | } |
| 86 | |
| 87 | Status validate_mm(const ITensorInfo *src, |
| 88 | const ITensorInfo *weights, |
| 89 | const ITensorInfo *biases, |
| 90 | const ITensorInfo *dst, |
| 91 | const ActivationLayerInfo &act, |
| 92 | bool enable_fast_math, |
| 93 | WeightFormat weight_format) |
| 94 | { |
| 95 | if (is_data_type_quantized_asymmetric(src->data_type())) |
| 96 | { |
| 97 | // Since we need negative offsets for computing convolution, we need to change QuantizationInfo() |
| 98 | // Extract and negate src and weights offset |
| 99 | const QuantizationInfo src_quantization_info(src->quantization_info().uniform().scale, |
| 100 | -src->quantization_info().uniform().offset); |
| 101 | const QuantizationInfo weights_quantization_info(weights->quantization_info().uniform().scale, |
| 102 | -weights->quantization_info().uniform().offset); |
| 103 | |
| 104 | GEMMLowpOutputStageInfo gemmlowp_output_stage_info; |
| 105 | ARM_COMPUTE_RETURN_ON_ERROR(get_gemmlowp_output_stage_info(src, weights, dst, act, gemmlowp_output_stage_info)); |
| 106 | |
| 107 | GEMMInfo gemm_info; |
| 108 | gemm_info.set_gemmlowp_output_stage(gemmlowp_output_stage_info); |
| 109 | gemm_info.set_fast_math(enable_fast_math); |
| 110 | |
| 111 | // Validate gemmlowp function |
| 112 | TensorInfo src_info = src->clone()->set_quantization_info(src_quantization_info); |
| 113 | TensorInfo weights_info = weights->clone()->set_quantization_info(weights_quantization_info); |
| 114 | ARM_COMPUTE_RETURN_ON_ERROR( |
| 115 | CpuGemmLowpMatrixMultiplyCore::validate(&src_info, &weights_info, biases, dst, gemm_info)); |
| 116 | } |
| 117 | else |
| 118 | { |
| 119 | GEMMInfo gemm_info; |
| 120 | gemm_info.set_weight_format(weight_format); |
| 121 | gemm_info.set_fixed_format(weight_format != WeightFormat::UNSPECIFIED); |
| 122 | gemm_info.set_fast_math(enable_fast_math); |
| 123 | gemm_info.set_activation_info(act); |
| 124 | ARM_COMPUTE_RETURN_ON_ERROR(CpuGemm::validate(src, weights, biases, dst, 1.f, 1.0f, gemm_info)); |
| 125 | } |
| 126 | |
| 127 | return Status{}; |
| 128 | } |
| 129 | } // namespace |
| 130 | |
| 131 | CpuFullyConnected::CpuFullyConnected() |
no test coverage detected