We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5ef0e18 + 691c27b commit adbb6efCopy full SHA for adbb6ef
array_api_compat/dask/array/_aliases.py
@@ -39,7 +39,22 @@
39
40
isdtype = get_xp(np)(_aliases.isdtype)
41
unstack = get_xp(da)(_aliases.unstack)
42
-astype = _aliases.astype
+
43
+def astype(
44
+ x: Array,
45
+ dtype: Dtype,
46
+ /,
47
+ *,
48
+ copy: bool = True,
49
+ device: Device | None = None
50
+) -> Array:
51
+ # TODO: respect device keyword?
52
+ if not copy and dtype == x.dtype:
53
+ return x
54
+ # dask astype doesn't respect copy=True,
55
+ # so call copy manually afterwards
56
+ x = x.astype(dtype)
57
+ return x.copy() if copy else x
58
59
# Common aliases
60
0 commit comments