Skip to content

Commit c297f26

Browse files
csummerseafacebook-github-bot
authored andcommitted
Add more options to the quantization model exporter (pytorch#18383)
Summary: Pull Request resolved: pytorch#18383 Add command line options for different quantization schemes. Reviewed By: amylittleyang Differential Revision: D14476862 fbshipit-source-id: 37fbf5b4c1c550121eae313f5a71d703a0a87f0f
1 parent 9e176fe commit c297f26

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

caffe2/quantization/server/caffe2_dnnlowp_utils.cc

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ void ReportQuantizationError(
237237
const QuantizationErrorStats& stat) {
238238
if (stat.sum_sq == 0) {
239239
LOG(INFO) << " output " << op->debug_def().output(0) << " of operator "
240-
<< op << " with type " << op->debug_def().type()
240+
<< op << " with type " << op->debug_def().type() << " and engine "
241+
<< op->debug_def().engine()
241242
<< " has l2 relative error nan (stat.sum_err_sq "
242243
<< stat.sum_err_sq << " stat.sum_sq 0)"
243244
<< " and max abs error " << stat.max_abs_err << " (reference is "
@@ -247,8 +248,8 @@ void ReportQuantizationError(
247248
<< " cnt " << stat.measure_cnt;
248249
} else {
249250
LOG(INFO) << " output " << op->debug_def().output(0) << " of operator "
250-
<< op << " with type " << op->debug_def().type()
251-
<< " has l2 relative error "
251+
<< op << " with type " << op->debug_def().type() << " and engine "
252+
<< op->debug_def().engine() << " has l2 relative error "
252253
<< std::sqrt(stat.sum_err_sq) / std::sqrt(stat.sum_sq)
253254
<< " and max abs error " << stat.max_abs_err << " (reference is "
254255
<< stat.max_err_ref << " and actual is " << stat.max_err_actual
@@ -305,18 +306,19 @@ static unique_ptr<QuantizationFactory> GetQuantizationFactoryOf_(
305306
"weight_quantization_kind",
306307
FLAGS_caffe2_dnnlowp_weight_quantization_kind);
307308

308-
VLOG(2) << "Quantization method for op with output " << op_def.output(0)
309-
<< " activation_precision " << activation_precision
310-
<< " weight_precision " << weight_precision
311-
<< " requantization_multiplier_precision "
312-
<< requantization_multiplier_precision
313-
<< " eltwise_quantization_precision "
314-
<< eltwise_quantization_precision << " preserve_activation_sparsity "
315-
<< preserve_activation_sparsity << " preserve_weight_sparsity "
316-
<< preserve_weight_sparsity << " force_scale_power_of_two "
317-
<< force_scale_power_of_two << " activation_quantization_kind "
318-
<< activation_quantization_kind << " weight_quantization_kind "
319-
<< weight_quantization_kind;
309+
LOG(WARNING) << "Quantization method for op with output " << op_def.output(0)
310+
<< " engine " << op_def.engine() << " activation_precision "
311+
<< activation_precision << " weight_precision "
312+
<< weight_precision << " requantization_multiplier_precision "
313+
<< requantization_multiplier_precision
314+
<< " eltwise_quantization_precision "
315+
<< eltwise_quantization_precision
316+
<< " preserve_activation_sparsity "
317+
<< preserve_activation_sparsity << " preserve_weight_sparsity "
318+
<< preserve_weight_sparsity << " force_scale_power_of_two "
319+
<< force_scale_power_of_two << " activation_quantization_kind "
320+
<< activation_quantization_kind << " weight_quantization_kind "
321+
<< weight_quantization_kind;
320322

321323
return unique_ptr<QuantizationFactory>(new QuantizationFactory(
322324
activation_precision,

0 commit comments

Comments
 (0)