Skip to content

Commit 25f8907

Browse files
authored
fix division by zero (PaddlePaddle#936)
1 parent 43f43c6 commit 25f8907

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

paddleslim/dygraph/prune/filter_pruner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def _cal_sensitive(self,
265265
baseline = eval_func()
266266
plan = self.prune_var(var_name, dims, ratio)
267267
pruned_metric = eval_func()
268-
loss = (baseline - pruned_metric) / baseline + 1e-3
268+
loss = (baseline - pruned_metric) / (baseline + 1e-3)
269269
_logger.info("pruned param: {}; {}; loss={}".format(
270270
var_name, ratio, loss))
271271
sensitivities[var_name][ratio] = loss

0 commit comments

Comments
 (0)