Skip to content

Commit 5ae8ec8

Browse files
fix
1 parent dfd4485 commit 5ae8ec8

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

array_api_compat/paddle/_aliases.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -790,15 +790,6 @@ def arange(
790790
device: Optional[Device] = None,
791791
**kwargs,
792792
) -> array:
793-
if stop is None:
794-
start, stop = 0, start
795-
if step > 0 and stop <= start or step < 0 and stop >= start:
796-
if dtype is None:
797-
if _builtin_all(isinstance(i, int) for i in [start, stop, step]):
798-
dtype = paddle.int64
799-
else:
800-
dtype = paddle.float32
801-
return paddle.empty([0], dtype=dtype, **kwargs).to(device)
802793
return paddle.arange(start, stop, step, dtype=dtype, **kwargs).to(device)
803794

804795

@@ -1100,7 +1091,10 @@ def asarray(
11001091
else:
11011092
if not paddle.is_tensor(obj) or (dtype is not None and obj.dtype != dtype):
11021093
obj = np.array(obj, copy=False)
1103-
obj = paddle.from_dlpack(obj.__dlpack__(), **kwargs).to(dtype)
1094+
if dtype != paddle.bool and dtype != "bool":
1095+
obj = paddle.from_dlpack(obj.__dlpack__(), **kwargs).to(dtype)
1096+
else:
1097+
obj = paddle.to_tensor(obj, dtype=dtype)
11041098
if device is not None:
11051099
obj = obj.to(device)
11061100
return obj

0 commit comments

Comments
 (0)