Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
* Redesigned `dpnp.modf` function to be a part of `ufunc` and `vm` pybind11 extensions [#2654](https://github.com/IntelPython/dpnp/pull/2654)
* Refactored `dpnp.fft` and `dpnp.random` submodules by removing wildcard imports and defining explicit public exports [#2649](https://github.com/IntelPython/dpnp/pull/2649)
* Added support for the `out` keyword to accept a tuple, bringing ufunc signatures into alignment with those in NumPy [#2664](https://github.com/IntelPython/dpnp/pull/2664)
* Unified `dpnp` public API exports by consolidating function exports in `__init__.py` and removing wildcard imports [#2665](https://github.com/IntelPython/dpnp/pull/2665) [#2666](https://github.com/IntelPython/dpnp/pull/2666)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove "--disable=c-extension-no-member" from .pre-commit-config.yaml now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And E501 skipping in .flake8


### Deprecated

Expand Down
87 changes: 81 additions & 6 deletions dpnp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
from .dpnp_array import dpnp_array as ndarray
from .dpnp_array_api_info import __array_namespace_info__
from .dpnp_flatiter import flatiter as flatiter
from .dpnp_iface_types import *
from .dpnp_iface_utils import *
from .dpnp_iface_utils import __all__ as _ifaceutils__all__
from ._version import get_versions
from . import exceptions as exceptions
from . import fft as fft
Expand All @@ -77,6 +74,81 @@
from . import scipy as scipy


# =============================================================================
# Data types, constants and type-related helpers
# =============================================================================

# -----------------------------------------------------------------------------
# Data types (borrowed from NumPy)
#
# The order of these declarations are borrowed from the NumPy document:
# https://numpy.org/doc/stable/reference/arrays.scalars.html
Comment on lines +84 to +85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not really make any sense, because there is a single from .dpnp_iface_types import below which is connected with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order is defined by the python sort linter and not by the pointing numpy's page.

# -----------------------------------------------------------------------------
from .dpnp_iface_types import (
bool,
bool_,
byte,
cdouble,
complex128,
complex64,
complexfloating,
csingle,
double,
dtype,
float16,
float32,
float64,
floating,
inexact,
int_,
int8,
int16,
int32,
int64,
integer,
intc,
intp,
longlong,
number,
short,
signedinteger,
single,
ubyte,
uint8,
uint16,
uint32,
uint64,
uintc,
uintp,
unsignedinteger,
ushort,
ulonglong,
)

# -----------------------------------------------------------------------------
# Constants (borrowed from NumPy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Constants (borrowed from NumPy)
# Constants

# -----------------------------------------------------------------------------
from .dpnp_iface_types import (
e,
euler_gamma,
inf,
nan,
newaxis,
pi,
)
Comment on lines +131 to +138
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be a part of the below Routines


# -----------------------------------------------------------------------------
# Type-related helper functions
# -----------------------------------------------------------------------------
from .dpnp_iface_types import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a part of Data type routines from https://numpy.org/doc/stable/reference/routines.dtype.html.
Why isn't it moved below to the routines?

common_type,
finfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to move dtype here instead of the above line#97 ?

iinfo,
isdtype,
issubdtype,
is_type_supported,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That needs to be moved away. It's a kind of deprecated API which we should not expose.
Probably it would be better to move that to dpnp/random/dpnp_iface_random.py (where it is only used) and to make it an internal function.

)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems result_type has be a part of that block, if we are following the routines page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And can_cast also


# =============================================================================
# Routines
#
Expand Down Expand Up @@ -424,6 +496,11 @@
unwrap,
)

# -----------------------------------------------------------------------------
# Miscellaneous routines
# -----------------------------------------------------------------------------
from .dpnp_iface_utils import byte_bounds

# -----------------------------------------------------------------------------
# Sorting, searching, and counting
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -514,10 +591,8 @@
)


__all__ = _ifaceutils__all__

# add submodules
__all__ += ["exceptions", "fft", "linalg", "random", "scipy"]
__all__ = ["exceptions", "fft", "linalg", "random", "scipy"]


__version__ = get_versions()["version"]
Expand Down
2 changes: 0 additions & 2 deletions dpnp/dpnp_array_api_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

import dpctl.tensor as dpt

__all__ = ["__array_namespace_info__"]


def __array_namespace_info__():
"""
Expand Down
54 changes: 0 additions & 54 deletions dpnp/dpnp_iface_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,6 @@
# pylint: disable=no-name-in-module
from .dpnp_utils import get_usm_allocations

__all__ = [
"bool",
"bool_",
"byte",
"cdouble",
"common_type",
"complex128",
"complex64",
"complexfloating",
"csingle",
"double",
"dtype",
"e",
"euler_gamma",
"finfo",
"float16",
"float32",
"float64",
"floating",
"iinfo",
"inexact",
"inf",
"int_",
"int8",
"int16",
"int32",
"int64",
"integer",
"intc",
"intp",
"isdtype",
"issubdtype",
"is_type_supported",
"longlong",
"nan",
"newaxis",
"number",
"pi",
"short",
"signedinteger",
"single",
"ubyte",
"uint8",
"uint16",
"uint32",
"uint64",
"uintc",
"uintp",
"unsignedinteger",
"ushort",
"ulonglong",
]


# pylint: disable=invalid-name
# =============================================================================
# Data types (borrowed from NumPy)
Expand Down
2 changes: 0 additions & 2 deletions dpnp/dpnp_iface_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

import dpnp

__all__ = ["byte_bounds"]


def byte_bounds(a):
"""
Expand Down
Loading