File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1118,13 +1118,13 @@ def asarray(
1118
1118
)
1119
1119
elif copy is True :
1120
1120
obj = np .array (obj , copy = True )
1121
- if np .issubdtype (obj .dtype , np .floating ):
1121
+ if np .issubdtype (obj .dtype , np .floating ) and dtype is None :
1122
1122
obj = obj .astype (paddle .get_default_dtype ())
1123
1123
return paddle .to_tensor (obj , dtype = dtype , place = device )
1124
1124
else :
1125
1125
if not paddle .is_tensor (obj ) or (dtype is not None and obj .dtype != dtype ):
1126
1126
obj = np .array (obj , copy = False )
1127
- if np .issubdtype (obj .dtype , np .floating ):
1127
+ if np .issubdtype (obj .dtype , np .floating ) and dtype is None :
1128
1128
obj = obj .astype (paddle .get_default_dtype ())
1129
1129
if dtype != paddle .bool and dtype != "bool" :
1130
1130
obj = paddle .from_dlpack (obj .__dlpack__ (), ** kwargs ).to (dtype )
You can’t perform that action at this time.
0 commit comments