From 2869c82d0420918038c1752840ff2428135cab6c Mon Sep 17 00:00:00 2001 From: Double_V Date: Tue, 30 Nov 2021 20:20:28 +0800 Subject: [PATCH] fix division by zero (#935) --- paddleslim/dygraph/prune/filter_pruner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddleslim/dygraph/prune/filter_pruner.py b/paddleslim/dygraph/prune/filter_pruner.py index 73c6f808..d2f05d7f 100644 --- a/paddleslim/dygraph/prune/filter_pruner.py +++ b/paddleslim/dygraph/prune/filter_pruner.py @@ -265,7 +265,7 @@ class FilterPruner(Pruner): baseline = eval_func() plan = self.prune_var(var_name, dims, ratio) pruned_metric = eval_func() - loss = (baseline - pruned_metric) / baseline + 1e-3 + loss = (baseline - pruned_metric) / (baseline + 1e-3) _logger.info("pruned param: {}; {}; loss={}".format( var_name, ratio, loss)) sensitivities[var_name][ratio] = loss -- GitLab