Skip to content

Commit bcd9e21

Browse files
committed
implement dpnp.einsum
1 parent 37c5fe5 commit bcd9e21

File tree

11 files changed

+2085
-122
lines changed

11 files changed

+2085
-122
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ env:
3939
third_party/cupy/linalg_tests/test_norms.py
4040
third_party/cupy/linalg_tests/test_product.py
4141
third_party/cupy/linalg_tests/test_solve.py
42+
third_party/cupy/linalg_tests/test_einsum.py
4243
third_party/cupy/logic_tests/test_comparison.py
4344
third_party/cupy/logic_tests/test_truth.py
4445
third_party/cupy/manipulation_tests/test_basic.py

dpnp/dpnp_array.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,14 @@ def astype(self, dtype, order="K", casting="unsafe", subok=True, copy=True):
549549
If it is False and no cast happens, then this method returns the array itself.
550550
Otherwise, a copy is returned.
551551
casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
552-
Controls what kind of data casting may occur. Defaults to 'unsafe' for backwards compatibility.
553-
'no' means the data types should not be cast at all.
554-
'equiv' means only byte-order changes are allowed.
555-
'safe' means only casts which can preserve values are allowed.
556-
'same_kind' means only safe casts or casts within a kind, like float64 to float32, are allowed.
557-
'unsafe' means any data conversions may be done.
552+
Controls what kind of data casting may occur.
553+
Defaults to ``'unsafe'`` for backwards compatibility.
554+
- 'no' means the data types should not be cast at all.
555+
- 'equiv' means only byte-order changes are allowed.
556+
- 'safe' means only casts which can preserve values are allowed.
557+
- 'same_kind' means only safe casts or casts within a kind, like
558+
float64 to float32, are allowed.
559+
- 'unsafe' means any data conversions may be done.
558560
copy : bool, optional
559561
By default, astype always returns a newly allocated array. If this is set to false, and the dtype,
560562
order, and subok requirements are satisfied, the input array is returned instead of a copy.

dpnp/dpnp_iface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def astype(x1, dtype, order="K", casting="unsafe", copy=True):
202202
- 'equiv' means only byte-order changes are allowed.
203203
- 'safe' means only casts which can preserve values are allowed.
204204
- 'same_kind' means only safe casts or casts within a kind, like
205-
float64 to float32, are allowed.
205+
float64 to float32, are allowed.
206206
- 'unsafe' means any data conversions may be done.
207207
copy : bool, optional
208208
By default, astype always returns a newly allocated array. If this
@@ -326,7 +326,7 @@ def check_supported_arrays_type(*arrays, scalar_type=False, all_scalars=False):
326326
f"An array must be any of supported type, but got {type(a)}"
327327
)
328328

329-
if len(arrays) > 1 and not (all_scalars or any_is_array):
329+
if len(arrays) > 0 and not (all_scalars or any_is_array):
330330
raise TypeError(
331331
"At least one input must be of supported array type, "
332332
"but got all scalars."

0 commit comments

Comments
 (0)