From c3b314c3734cf4205ba93322125a81656f4d8e01 Mon Sep 17 00:00:00 2001 From: wangchaochaohu Date: Sat, 5 Sep 2020 11:36:42 +0800 Subject: [PATCH] refine the error of message test=develop (#27067) --- python/paddle/fluid/layers/tensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/layers/tensor.py b/python/paddle/fluid/layers/tensor.py index 2dbb1db664e..75b2bf849cc 100644 --- a/python/paddle/fluid/layers/tensor.py +++ b/python/paddle/fluid/layers/tensor.py @@ -1446,6 +1446,8 @@ def linspace(start, stop, num, dtype=None, name=None): tensor_num = num tensor_start = start tensor_stop = stop + if not isinstance(num, Variable): + check_type(num, 'num', (int), 'linspace') if not isinstance(dtype, core.VarDesc.VarType): dtype = convert_np_dtype_to_dtype_(dtype) if not isinstance(start, Variable): @@ -1471,8 +1473,6 @@ def linspace(start, stop, num, dtype=None, name=None): check_type(stop, 'stop', (int, float), 'linspace') if isinstance(num, Variable): check_dtype(num.dtype, 'num', ['int32'], 'linspace') - else: - check_type(num, 'num', (int), 'linspace') check_dtype(dtype, 'dtype', ['int32', 'int64', 'float32', 'float64'], 'linspace') -- GitLab