| 138 | } |
| 139 | |
| 140 | Status ClGemmConv2d::validate_mm(const ITensorInfo *src, |
| 141 | const ITensorInfo *weights, |
| 142 | const ITensorInfo *biases, |
| 143 | const ITensorInfo *dst, |
| 144 | const GEMMLowpOutputStageInfo &gemmlowp_output_stage, |
| 145 | int gemm_3d_depth, |
| 146 | bool skip_im2col, |
| 147 | const ActivationLayerInfo &act_info) |
| 148 | { |
| 149 | const bool is_quantized = is_data_type_quantized_asymmetric(src->data_type()); |
| 150 | |
| 151 | const GEMMInfo &gemm_info = GEMMInfo(false, // is_a_reshaped |
| 152 | false, // is_b_reshaped |
| 153 | true, // reshape_b_only_on_first_run |
| 154 | gemm_3d_depth, // depth_output_gemm3d |
| 155 | skip_im2col, // reinterpret_input_as_3d |
| 156 | false, // retain_internal_weights |
| 157 | gemmlowp_output_stage, // gemmlowp_output_stage |
| 158 | false, // fast_math |
| 159 | false, // fp_mixed_precision |
| 160 | true, // broadcast_bias |
| 161 | act_info // activation_info |
| 162 | ); |
| 163 | |
| 164 | if (is_quantized) |
| 165 | { |
| 166 | // Since we need negative offsets for computing convolution, we need to change QuantizationInfo() |
| 167 | // Extract and negate input and weights offset |
| 168 | const QuantizationInfo input_quantization_info = src->quantization_info(); |
| 169 | const QuantizationInfo weights_quantization_info = weights->quantization_info(); |
| 170 | |
| 171 | std::unique_ptr<ITensorInfo> src_qa = src->clone(); |
| 172 | std::unique_ptr<ITensorInfo> weights_qa = weights->clone(); |
| 173 | src_qa->set_quantization_info( |
| 174 | QuantizationInfo(input_quantization_info.uniform().scale, -input_quantization_info.uniform().offset)); |
| 175 | weights_qa->set_quantization_info( |
| 176 | QuantizationInfo(weights_quantization_info.uniform().scale, -weights_quantization_info.uniform().offset)); |
| 177 | |
| 178 | // Perform validation step on GEMMLowp |
| 179 | return ClGemmLowpMatrixMultiplyCore::validate(src_qa.get(), weights_qa.get(), biases, dst, gemm_info); |
| 180 | } |
| 181 | else |
| 182 | { |
| 183 | // Perform validation step on Matrix multiply function |
| 184 | return ClGemm::validate(src, weights, biases, dst, 1.0f, 1.0f, gemm_info); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | void ClGemmConv2d::configure(const CLCompileContext &compile_context, |
| 189 | ITensorInfo *src, |
nothing calls this directly
no test coverage detected