Skip to content

Commit

Permalink
Implemented dpnp.fromfunction, dpnp.fromiter and dpnp.loadtxt (#1728)
Browse files Browse the repository at this point in the history
* Implemented dpnp.fromfunction

* Added dpnp.fromiter

* Added dpnp.loadtxt

* Aligned array creation page with numpy content

* Alligned usm_type description across all aray creation functions

* Change usm_type to None default value for function with input array as argument

* Updated to use dpnp.check_limitations

* Rollbacked changed default usm_type for linspace, logspace and geomspace

* Added handling of usm_type=None to array creation functions
  • Loading branch information
antonwolfy committed Feb 25, 2024
1 parent 3e251c8 commit fc317cb
Show file tree
Hide file tree
Showing 7 changed files with 405 additions and 87 deletions.
10 changes: 5 additions & 5 deletions doc/reference/creation.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.. _routines.creation:

Array Creation Routines
Array creation routines
=======================

.. https://docs.scipy.org/doc/numpy/reference/routines.array-creation.html
Basic creation routines
From shape or value
-----------------------

.. autosummary::
Expand All @@ -24,7 +24,7 @@ Basic creation routines
dpnp.full_like


Creation from other data
From existing data
------------------------

.. autosummary::
Expand All @@ -35,6 +35,7 @@ Creation from other data
dpnp.asarray
dpnp.asanyarray
dpnp.ascontiguousarray
dpnp.astype
dpnp.copy
dpnp.frombuffer
dpnp.from_dlpack
Expand All @@ -61,7 +62,7 @@ Numerical ranges
dpnp.ogrid


Matrix creation
Building matrices
---------------

.. autosummary::
Expand All @@ -82,5 +83,4 @@ The Matrix class
:toctree: generated/
:nosignatures:

dpnp.mat
dpnp.bmat
4 changes: 2 additions & 2 deletions dpnp/dpnp_algo/dpnp_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ class dpnp_nd_grid:
def __init__(
self, sparse=False, device=None, usm_type="device", sycl_queue=None
):
dpu.validate_usm_type(usm_type, allow_none=False)
dpu.validate_usm_type(usm_type, allow_none=True)
self.sparse = sparse
self.usm_type = usm_type
self.usm_type = "device" if usm_type is None else usm_type
self.sycl_queue_normalized = dpnp.get_normalized_queue_device(
sycl_queue=sycl_queue, device=device
)
Expand Down
Loading

0 comments on commit fc317cb

Please sign in to comment.