diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 7394c247061e8a1405689c7bcd6f790ae87a4f43..d6e378396f354f505de493d7fcf0294fcc7eed5a 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -1301,16 +1301,18 @@ def arange(start=0, end=None, step=1, dtype=None, name=None): if dtype is None: for val in [start, end, step]: - if isinstance(val, Variable) and not val.is_integer(): - dtype = paddle.get_default_dtype() - break - elif not isinstance(val, (int, np.integer)) and not isinstance( - val, Variable - ): - dtype = paddle.get_default_dtype() - break + if isinstance(val, Variable): + if not val.is_integer(): + dtype = paddle.get_default_dtype() + break + else: + dtype = 'int64' else: - dtype = 'int64' + if not isinstance(val, np.integer) and not isinstance(val, int): + dtype = paddle.get_default_dtype() + break + else: + dtype = 'int64' out_shape = None if not in_dynamic_mode() and (