From bbcf1ad263c54b433306e12e325d6202f2ee313d Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Wed, 29 Aug 2018 16:59:39 +0800 Subject: [PATCH] update --- python/paddle/fluid/contrib/memory_usage_calc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/paddle/fluid/contrib/memory_usage_calc.py b/python/paddle/fluid/contrib/memory_usage_calc.py index 5ffdca82bd..baa14a573f 100644 --- a/python/paddle/fluid/contrib/memory_usage_calc.py +++ b/python/paddle/fluid/contrib/memory_usage_calc.py @@ -87,8 +87,13 @@ def memory_usage(program, batch_size): continue data_count = 1 + neg_dim_count = 0 for x in var.shape: if x < 0: + if neg_dim_count >= 1: + raise ValueError("Var %s has more than one negtive dim." + % (var_name)) + neg_dim_count += 1 data_count *= batch_size * (-x) else: data_count *= x -- GitLab