We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7b8555e commit 603c852Copy full SHA for 603c852
1 file changed
array_api_compat/paddle/_aliases.py
@@ -1118,13 +1118,13 @@ def asarray(
1118
)
1119
elif copy is True:
1120
obj = np.array(obj, copy=True)
1121
- if np.issubdtype(obj.dtype, np.floating):
+ if np.issubdtype(obj.dtype, np.floating) and dtype is None:
1122
obj = obj.astype(paddle.get_default_dtype())
1123
return paddle.to_tensor(obj, dtype=dtype, place=device)
1124
else:
1125
if not paddle.is_tensor(obj) or (dtype is not None and obj.dtype != dtype):
1126
obj = np.array(obj, copy=False)
1127
1128
1129
if dtype != paddle.bool and dtype != "bool":
1130
obj = paddle.from_dlpack(obj.__dlpack__(), **kwargs).to(dtype)
0 commit comments