Skip to content

Commit c44f751

Browse files
committed
fix doc string
1 parent 420dc9d commit c44f751

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

dpnp/dpnp_iface_linearalgebra.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def dot(a, b, out=None):
169169

170170
def einsum(*operands, out=None, optimize=False, **kwargs):
171171
"""
172-
einsum(subscripts, *operands, out=None, dtype=None, order="K",
173-
casting="safe", optimize=False)
172+
einsum(subscripts, *operands, out=None, dtype=None, order="K", \
173+
casting="safe", optimize=False)
174174
175175
Evaluates the Einstein summation convention on the operands.
176176
@@ -191,27 +191,28 @@ def einsum(*operands, out=None, optimize=False, **kwargs):
191191
If provided, forces the calculation to use the data type specified.
192192
Default is ``None``.
193193
order : {"C", "F", "A", "K"}, optional
194-
Controls the memory layout of the output. "C" means it should
195-
be C-contiguous. "F" means it should be F-contiguous,
196-
"A" means it should be "F" if the inputs are all "F", "C" otherwise.
197-
"K" means it should be as close to the layout as the inputs as
194+
Controls the memory layout of the output. ``"C"`` means it should be
195+
C-contiguous. ``"F"`` means it should be F-contiguous, ``"A"`` means
196+
it should be ``"F"`` if the inputs are all ``"F"``, ``"C"`` otherwise.
197+
``"K"`` means it should be as close to the layout as the inputs as
198198
is possible, including arbitrarily permuted axes.
199199
Default is ``"K"``.
200200
casting : {"no", "equiv", "safe", "same_kind", "unsafe"}, optional
201201
Controls what kind of data casting may occur. Setting this to
202-
"unsafe" is not recommended, as it can adversely affect accumulations.
202+
``"unsafe"`` is not recommended, as it can adversely affect
203+
accumulations.
203204
204-
* "no" means the data types should not be cast at all.
205-
* "equiv" means only byte-order changes are allowed.
206-
* "safe" means only casts which can preserve values are allowed.
207-
* "same_kind" means only safe casts or casts within a kind,
205+
* ``"no"`` means the data types should not be cast at all.
206+
* ``"equiv"`` means only byte-order changes are allowed.
207+
* ``"safe"`` means only casts which can preserve values are allowed.
208+
* ``"same_kind"`` means only safe casts or casts within a kind,
208209
like float64 to float32, are allowed.
209-
* "unsafe" means any data conversions may be done.
210+
* ``"unsafe"`` means any data conversions may be done.
210211
211212
Default is ``"safe"``.
212213
optimize : {False, True, "greedy", "optimal"}, optional
213214
Controls if intermediate optimization should occur. No optimization
214-
will occur if ``False`` and ``True`` will default to the "greedy"
215+
will occur if ``False`` and ``True`` will default to the ``"greedy"``
215216
algorithm. Also accepts an explicit contraction list from the
216217
:obj:`dpnp.einsum_path` function. Default is ``False``.
217218
@@ -383,8 +384,8 @@ def einsum(*operands, out=None, optimize=False, **kwargs):
383384
384385
>>> a = np.ones(64000).reshape(20, 40, 80)
385386
386-
(benchmarked on 12th Gen Intel(R) Core(TM) i7-1265U.)
387-
Basic `einsum`: 146 ms ± 23.5 ms per loop
387+
Basic `einsum`: 146 ms ± 23.5 ms per loop (benchmarked on 12th
388+
Gen Intel® Core™ i7-1265U)
388389
389390
>>> %timeit -r 10 -n 50 np.einsum("ijk,ilm,njm,nlk,abc->",a,a,a,a,a)
390391
@@ -462,17 +463,17 @@ def einsum_path(*operands, optimize="greedy", einsum_call=False):
462463
contraction path
463464
* if ``False`` or ``None`` no optimization is taken
464465
* if ``True`` defaults to the "greedy" algorithm
465-
* "optimal" is an algorithm that combinatorially explores all possible
466-
ways of contracting the listed tensors and chooses the least costly
467-
path. Scales exponentially with the number of terms in the
468-
contraction.
469-
* "greedy" is an algorithm that chooses the best pair contraction
466+
* ``"optimal"`` is an algorithm that combinatorially explores all
467+
possible ways of contracting the listed tensors and chooses the
468+
least costly path. Scales exponentially with the number of terms
469+
in the contraction.
470+
* ``"greedy"`` is an algorithm that chooses the best pair contraction
470471
at each step. Effectively, this algorithm searches the largest inner,
471472
Hadamard, and then outer products at each step. Scales cubically with
472-
the number of terms in the contraction. Equivalent to the "optimal"
473-
path for most contractions.
473+
the number of terms in the contraction. Equivalent to the
474+
``"optimal"`` path for most contractions.
474475
475-
Default is "greedy".
476+
Default is ``"greedy"``.
476477
477478
Returns
478479
-------

0 commit comments

Comments
 (0)