未验证 提交 aeee5b1e 编写于 作者: Z zxcd 提交者: GitHub

Make arange code logic clearer (#54264)

上级 988c58e5
...@@ -1301,12 +1301,14 @@ def arange(start=0, end=None, step=1, dtype=None, name=None): ...@@ -1301,12 +1301,14 @@ def arange(start=0, end=None, step=1, dtype=None, name=None):
if dtype is None: if dtype is None:
for val in [start, end, step]: for val in [start, end, step]:
if isinstance(val, Variable) and not val.is_integer(): if isinstance(val, Variable):
if not val.is_integer():
dtype = paddle.get_default_dtype() dtype = paddle.get_default_dtype()
break break
elif not isinstance(val, (int, np.integer)) and not isinstance( else:
val, Variable dtype = 'int64'
): else:
if not isinstance(val, np.integer) and not isinstance(val, int):
dtype = paddle.get_default_dtype() dtype = paddle.get_default_dtype()
break break
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册