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

Make arange code logic clearer (#54264)

上级 988c58e5
......@@ -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 (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册