Skip to content

Commit 8bdfd40

Browse files
committed
Align real and imag signatures with ones from dpctl
1 parent ac69f42 commit 8bdfd40

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

dpnp/dpnp_algo/dpnp_elementwise_common.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,27 @@ def __call__(self, x, deg=False):
498498
return res
499499

500500

501+
class DPNPImag(DPNPUnaryFunc):
502+
"""Class that implements dpnp.imag unary element-wise functions."""
503+
504+
def __init__(
505+
self,
506+
name,
507+
result_type_resolver_fn,
508+
unary_dp_impl_fn,
509+
docs,
510+
):
511+
super().__init__(
512+
name,
513+
result_type_resolver_fn,
514+
unary_dp_impl_fn,
515+
docs,
516+
)
517+
518+
def __call__(self, x, out, order):
519+
return super().__call__(x, out=out, order=order)
520+
521+
501522
class DPNPReal(DPNPUnaryFunc):
502523
"""Class that implements dpnp.real unary element-wise functions."""
503524

@@ -515,9 +536,9 @@ def __init__(
515536
docs,
516537
)
517538

518-
def __call__(self, x):
539+
def __call__(self, x, out, order):
519540
if numpy.iscomplexobj(x):
520-
return super().__call__(x)
541+
return super().__call__(x, out=out, order=order)
521542
return x
522543

523544

dpnp/dpnp_iface_mathematical.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from .dpnp_algo.dpnp_elementwise_common import (
6363
DPNPAngle,
6464
DPNPBinaryFunc,
65+
DPNPImag,
6566
DPNPReal,
6667
DPNPRound,
6768
DPNPUnaryFunc,
@@ -2355,12 +2356,6 @@ def gradient(f, *varargs, axis=None, edge_order=1):
23552356
data type, the returned array has a floating-point data type
23562357
with the same floating-point precision as complex input.
23572358
2358-
Limitations
2359-
-----------
2360-
Parameters `where' and `subok` are supported with their default values.
2361-
Keyword argument `kwargs` is currently unsupported.
2362-
Otherwise ``NotImplementedError`` exception will be raised.
2363-
23642359
See Also
23652360
--------
23662361
:obj:`dpnp.real` : Return the real part of the complex argument.
@@ -2385,7 +2380,7 @@ def gradient(f, *varargs, axis=None, edge_order=1):
23852380
array(1.)
23862381
"""
23872382

2388-
imag = DPNPUnaryFunc(
2383+
imag = DPNPImag(
23892384
"imag",
23902385
ti._imag_result_type,
23912386
ti._imag,
@@ -3331,6 +3326,13 @@ def prod(
33313326
----------
33323327
x : {dpnp.ndarray, usm_ndarray}
33333328
Input array, expected to have numeric data type.
3329+
out : {None, dpnp.ndarray, usm_ndarray}, optional
3330+
Output array to populate.
3331+
Array must have the correct shape and the expected data type.
3332+
Default: ``None``.
3333+
order : {"C", "F", "A", "K"}, optional
3334+
Memory layout of the newly output array, if parameter `out` is ``None``.
3335+
Default: ``"K"``.
33343336
33353337
Returns
33363338
-------

0 commit comments

Comments
 (0)