File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1118,13 +1118,13 @@ def asarray(
11181118 )
11191119 elif copy is True :
11201120 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 :
11221122 obj = obj .astype (paddle .get_default_dtype ())
11231123 return paddle .to_tensor (obj , dtype = dtype , place = device )
11241124 else :
11251125 if not paddle .is_tensor (obj ) or (dtype is not None and obj .dtype != dtype ):
11261126 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 :
11281128 obj = obj .astype (paddle .get_default_dtype ())
11291129 if dtype != paddle .bool and dtype != "bool" :
11301130 obj = paddle .from_dlpack (obj .__dlpack__ (), ** kwargs ).to (dtype )
You can’t perform that action at this time.
0 commit comments