From 6d1d7c8acfff59c6e57f64a67d16351c5a00bdcc Mon Sep 17 00:00:00 2001 From: guomingz Date: Wed, 8 May 2019 15:42:00 +0800 Subject: [PATCH] Fix the KL algorithm bug when calculated the size of tensor. (#17198) * resolve #17184 Fix the KL algorithm bug when calculated the size of tensor. * Add the missing test=develop. test=develop --- python/paddle/fluid/contrib/int8_inference/utility.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/contrib/int8_inference/utility.py b/python/paddle/fluid/contrib/int8_inference/utility.py index b35d9f2424..605dfdf53d 100644 --- a/python/paddle/fluid/contrib/int8_inference/utility.py +++ b/python/paddle/fluid/contrib/int8_inference/utility.py @@ -634,7 +634,8 @@ class Calibrator(object): break starting_iter = int(0.6 * ending_iter) bin_width = hist_edeges[1] - hist_edeges[0] - P_sum = len(activation_blob) + + P_sum = len(np.array(activation_blob).ravel()) min_kl_divergence = 0 min_kl_index = 0 kl_inited = False -- GitLab