Skip to content

Commit

Permalink
Update dpnp.place implementation to get rid of limitations for inpu…
Browse files Browse the repository at this point in the history
…t arguments (#1912)

* Remove limitations from dpnp.take implementation

* Add more test to cover specail cases and increase code coverage

* Applied pre-commit hook

* Corrected test_over_index

* Update docsctrings with resolving typos

* Use dpnp.reshape() to change shape and create dpnp array from usm_ndarray result

* Remove limitations from dpnp.place implementation

* Update relating tests

* Roll back changed in dpnp.vander

* Remove data sync at the end of function

* Remove data sync from dpnp.get_result_array()

* Fix typo in docstring

* Corrected a link to dpnp.copyto() in description e353d7d
  • Loading branch information
github-actions[bot] committed Jul 10, 2024
1 parent dd0c1f8 commit ae55b1f
Show file tree
Hide file tree
Showing 495 changed files with 1,637 additions and 1,510 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 3467c298913e78a58bb2d8c148434fe2
config: 9d15470216a92597d3a920da885f500e
tags: 645f666f9bcd5a90fca523b33c5a78b7
6 changes: 3 additions & 3 deletions _modules/dpnp/dpnp_array.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dpnp.dpnp_array &mdash; Data Parallel Extension for NumPy 0.16.0dev0+47.gce26cf0c3 documentation</title>
<title>dpnp.dpnp_array &mdash; Data Parallel Extension for NumPy 0.16.0dev0+48.ge353d7dc14 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />

Expand All @@ -23,7 +23,7 @@

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=0136441f"></script>
<script src="../../_static/documentation_options.js?v=450e44f5"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
Expand All @@ -43,7 +43,7 @@
Data Parallel Extension for NumPy
</a>
<div class="version">
0.16.0dev0+47.gce26cf0c3
0.16.0dev0+48.ge353d7dc14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
6 changes: 3 additions & 3 deletions _modules/dpnp/dpnp_flatiter.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dpnp.dpnp_flatiter &mdash; Data Parallel Extension for NumPy 0.16.0dev0+47.gce26cf0c3 documentation</title>
<title>dpnp.dpnp_flatiter &mdash; Data Parallel Extension for NumPy 0.16.0dev0+48.ge353d7dc14 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />

Expand All @@ -23,7 +23,7 @@

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=0136441f"></script>
<script src="../../_static/documentation_options.js?v=450e44f5"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
Expand All @@ -43,7 +43,7 @@
Data Parallel Extension for NumPy
</a>
<div class="version">
0.16.0dev0+47.gce26cf0c3
0.16.0dev0+48.ge353d7dc14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
56 changes: 53 additions & 3 deletions _modules/dpnp/dpnp_iface.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dpnp.dpnp_iface &mdash; Data Parallel Extension for NumPy 0.16.0dev0+47.gce26cf0c3 documentation</title>
<title>dpnp.dpnp_iface &mdash; Data Parallel Extension for NumPy 0.16.0dev0+48.ge353d7dc14 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />

Expand All @@ -23,7 +23,7 @@

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=0136441f"></script>
<script src="../../_static/documentation_options.js?v=450e44f5"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
Expand All @@ -43,7 +43,7 @@
Data Parallel Extension for NumPy
</a>
<div class="version">
0.16.0dev0+47.gce26cf0c3
0.16.0dev0+48.ge353d7dc14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -147,6 +147,7 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
<span class="s2">&quot;array_equal&quot;</span><span class="p">,</span>
<span class="s2">&quot;asnumpy&quot;</span><span class="p">,</span>
<span class="s2">&quot;astype&quot;</span><span class="p">,</span>
<span class="s2">&quot;as_usm_ndarray&quot;</span><span class="p">,</span>
<span class="s2">&quot;check_limitations&quot;</span><span class="p">,</span>
<span class="s2">&quot;check_supported_arrays_type&quot;</span><span class="p">,</span>
<span class="s2">&quot;convert_single_elem_array_to_scalar&quot;</span><span class="p">,</span>
Expand Down Expand Up @@ -346,6 +347,55 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>



<span class="k">def</span> <span class="nf">as_usm_ndarray</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">usm_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">sycl_queue</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return :class:`dpctl.tensor.usm_ndarray` from input object `a`.</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> a : {array_like, scalar}</span>
<span class="sd"> Input array or scalar.</span>
<span class="sd"> dtype : {None, dtype}, optional</span>
<span class="sd"> The desired dtype for the result array if new array is creating. If not</span>
<span class="sd"> given, a default dtype will be used that can represent the values (by</span>
<span class="sd"> considering Promotion Type Rule and device capabilities when necessary).</span>
<span class="sd"> Default: ``None``.</span>
<span class="sd"> device : {None, string, SyclDevice, SyclQueue}, optional</span>
<span class="sd"> An array API concept of device where the result array is created if</span>
<span class="sd"> required.</span>
<span class="sd"> The `device` can be ``None`` (the default), an OneAPI filter selector</span>
<span class="sd"> string, an instance of :class:`dpctl.SyclDevice` corresponding to</span>
<span class="sd"> a non-partitioned SYCL device, an instance of :class:`dpctl.SyclQueue`,</span>
<span class="sd"> or a `Device` object returned by</span>
<span class="sd"> :obj:`dpnp.dpnp_array.dpnp_array.device` property.</span>
<span class="sd"> Default: ``None``.</span>
<span class="sd"> usm_type : {None, &quot;device&quot;, &quot;shared&quot;, &quot;host&quot;}, optional</span>
<span class="sd"> The type of SYCL USM allocation for the result array if new array</span>
<span class="sd"> is created.</span>
<span class="sd"> Default: ``None``.</span>
<span class="sd"> sycl_queue : {None, SyclQueue}, optional</span>
<span class="sd"> A SYCL queue to use for result array allocation if required.</span>
<span class="sd"> Default: ``None``.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> out : usm_ndarray</span>
<span class="sd"> A dpctl USM ndarray from input array or scalar `a`.</span>
<span class="sd"> If `a` is instance of :class:`dpnp.ndarray`</span>
<span class="sd"> or :class:`dpctl.tensor.usm_ndarray`, no array allocation will be done</span>
<span class="sd"> and `dtype`, `device`, `usm_type`, `sycl_queue` keywords</span>
<span class="sd"> will be ignored.</span>

<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="n">is_supported_array_type</span><span class="p">(</span><span class="n">a</span><span class="p">):</span>
<span class="k">return</span> <span class="n">get_usm_ndarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>

<span class="k">return</span> <span class="n">dpt</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span>
<span class="n">a</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">device</span><span class="p">,</span> <span class="n">usm_type</span><span class="o">=</span><span class="n">usm_type</span><span class="p">,</span> <span class="n">sycl_queue</span><span class="o">=</span><span class="n">sycl_queue</span>
<span class="p">)</span>


<span class="k">def</span> <span class="nf">check_limitations</span><span class="p">(</span>
<span class="n">order</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">subok</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">like</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">initial</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="kc">True</span>
<span class="p">):</span>
Expand Down
6 changes: 3 additions & 3 deletions _modules/dpnp/dpnp_iface_arraycreation.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dpnp.dpnp_iface_arraycreation &mdash; Data Parallel Extension for NumPy 0.16.0dev0+47.gce26cf0c3 documentation</title>
<title>dpnp.dpnp_iface_arraycreation &mdash; Data Parallel Extension for NumPy 0.16.0dev0+48.ge353d7dc14 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />

Expand All @@ -23,7 +23,7 @@

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=0136441f"></script>
<script src="../../_static/documentation_options.js?v=450e44f5"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
Expand All @@ -43,7 +43,7 @@
Data Parallel Extension for NumPy
</a>
<div class="version">
0.16.0dev0+47.gce26cf0c3
0.16.0dev0+48.ge353d7dc14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
6 changes: 3 additions & 3 deletions _modules/dpnp/dpnp_iface_counting.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dpnp.dpnp_iface_counting &mdash; Data Parallel Extension for NumPy 0.16.0dev0+47.gce26cf0c3 documentation</title>
<title>dpnp.dpnp_iface_counting &mdash; Data Parallel Extension for NumPy 0.16.0dev0+48.ge353d7dc14 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />

Expand All @@ -23,7 +23,7 @@

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=0136441f"></script>
<script src="../../_static/documentation_options.js?v=450e44f5"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
Expand All @@ -43,7 +43,7 @@
Data Parallel Extension for NumPy
</a>
<div class="version">
0.16.0dev0+47.gce26cf0c3
0.16.0dev0+48.ge353d7dc14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
14 changes: 6 additions & 8 deletions _modules/dpnp/dpnp_iface_histograms.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dpnp.dpnp_iface_histograms &mdash; Data Parallel Extension for NumPy 0.16.0dev0+47.gce26cf0c3 documentation</title>
<title>dpnp.dpnp_iface_histograms &mdash; Data Parallel Extension for NumPy 0.16.0dev0+48.ge353d7dc14 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />

Expand All @@ -23,7 +23,7 @@

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=0136441f"></script>
<script src="../../_static/documentation_options.js?v=450e44f5"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
Expand All @@ -43,7 +43,7 @@
Data Parallel Extension for NumPy
</a>
<div class="version">
0.16.0dev0+47.gce26cf0c3
0.16.0dev0+48.ge353d7dc14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -254,11 +254,9 @@ <h1>Source code for dpnp.dpnp_iface_histograms</h1><div class="highlight"><pre>
<span class="s2">&quot;a and bins must be allocated on the same SYCL queue&quot;</span>
<span class="p">)</span>

<span class="n">bin_edges</span> <span class="o">=</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">get_usm_ndarray</span><span class="p">(</span><span class="n">bins</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">bin_edges</span> <span class="o">=</span> <span class="n">dpt</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span>
<span class="n">bins</span><span class="p">,</span> <span class="n">sycl_queue</span><span class="o">=</span><span class="n">sycl_queue</span><span class="p">,</span> <span class="n">usm_type</span><span class="o">=</span><span class="n">usm_type</span>
<span class="p">)</span>
<span class="n">bin_edges</span> <span class="o">=</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">as_usm_ndarray</span><span class="p">(</span>
<span class="n">bins</span><span class="p">,</span> <span class="n">usm_type</span><span class="o">=</span><span class="n">usm_type</span><span class="p">,</span> <span class="n">sycl_queue</span><span class="o">=</span><span class="n">sycl_queue</span>
<span class="p">)</span>

<span class="k">if</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">bin_edges</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">bin_edges</span><span class="p">[</span><span class="mi">1</span><span class="p">:]):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
Expand Down
Loading

0 comments on commit ae55b1f

Please sign in to comment.