Skip to content

Commit d7082ad

Browse files
authored
implement dpnp.einsum (#1779)
* implement dpnp.einsum * allow using scalar when possible * fix doc string * address comments * fix merge mistake * fix spelling issues
1 parent 6220539 commit d7082ad

15 files changed

+2097
-121
lines changed

.github/workflows/conda-package.yml

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

doc/known_words.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ broadcastable
55
broadcasted
66
byteorder
77
Cholesky
8+
combinatorially
89
conda
10+
cubically
911
Decompositions
1012
dimensionality
1113
docstring
@@ -22,6 +24,7 @@ finfo
2224
finiteness
2325
Fortran
2426
Frobenius
27+
Hadamard
2528
Hypergeometric
2629
iinfo
2730
Infs

dpnp/dpnp_array.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,14 @@ def astype(self, dtype, order="K", casting="unsafe", subok=True, copy=True):
580580
If it is False and no cast happens, then this method returns the array itself.
581581
Otherwise, a copy is returned.
582582
casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
583-
Controls what kind of data casting may occur. Defaults to 'unsafe' for backwards compatibility.
584-
583+
Controls what kind of data casting may occur.
584+
Defaults to ``'unsafe'`` for backwards compatibility.
585585
- 'no' means the data types should not be cast at all.
586586
- 'equiv' means only byte-order changes are allowed.
587587
- 'safe' means only casts which can preserve values are allowed.
588-
- 'same_kind' means only safe casts or casts within a kind, like float64 to float32, are allowed.
588+
- 'same_kind' means only safe casts or casts within a kind, like
589+
float64 to float32, are allowed.
589590
- 'unsafe' means any data conversions may be done.
590-
591591
copy : bool, optional
592592
By default, ``astype`` always returns a newly allocated array. If
593593
this is set to ``False``, and the `dtype`, `order`, and `subok`

dpnp/dpnp_iface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def check_supported_arrays_type(*arrays, scalar_type=False, all_scalars=False):
331331
f"An array must be any of supported type, but got {type(a)}"
332332
)
333333

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

0 commit comments

Comments
 (0)