Skip to content

Commit bbcf1ad

Browse files
committed
update
1 parent fb08e16 commit bbcf1ad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/paddle/fluid/contrib/memory_usage_calc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ def memory_usage(program, batch_size):
8787
continue
8888

8989
data_count = 1
90+
neg_dim_count = 0
9091
for x in var.shape:
9192
if x < 0:
93+
if neg_dim_count >= 1:
94+
raise ValueError("Var %s has more than one negtive dim."
95+
% (var_name))
96+
neg_dim_count += 1
9297
data_count *= batch_size * (-x)
9398
else:
9499
data_count *= x

0 commit comments

Comments
 (0)