Skip to content

Commit

Permalink
impelment dpnp.std, dpnp.var and dpnp.nanvar (#1635)
Browse files Browse the repository at this point in the history
* impelment dpnp.var and dpnp.std

* implement dpnp.nanvar

* support out keyword for dpnp.sum

* add more tests

* use replace_nan func for nanprod

* address comments

* update test_sum_empty_axis

* address new comments

* minor update

* address remarks

* remove uncalled raise 996cf54
  • Loading branch information
github-actions[bot] committed Dec 16, 2023
1 parent 1d87295 commit 89f7f5d
Show file tree
Hide file tree
Showing 474 changed files with 2,668 additions and 2,793 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: 231a89b9dd9d18cefec2935ef6766b8a
config: 97fecb7946d85bf7df10c56716a331b7
tags: 645f666f9bcd5a90fca523b33c5a78b7
72 changes: 32 additions & 40 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.13.1dev1+20.gc35d8b6fda documentation</title>
<title>dpnp.dpnp_array &mdash; Data Parallel Extension for NumPy 0.13.1dev1+17.g996cf5405e 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=e64bcc3b"></script>
<script src="../../_static/documentation_options.js?v=e2b28984"></script>
<script src="../../_static/doctools.js?v=888ff710"></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.13.1dev1+20.gc35d8b6fda
0.13.1dev1+17.g996cf5405e
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -777,19 +777,7 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">choose</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">choices</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">mode</span><span class="p">)</span></div>


<div class="viewcode-block" id="dpnp_array.clip">
<a class="viewcode-back" href="../../reference/generated/dpnp.dpnp_array.dpnp_array.html#dpnp.dpnp_array.dpnp_array.clip">[docs]</a>
<span class="k">def</span> <span class="nf">clip</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">min</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">out</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Clip (limit) the values in an array.</span>

<span class="sd"> Refer to :obj:`dpnp.clip` for full documentation.</span>

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

<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">clip</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">min</span><span class="p">,</span> <span class="nb">max</span><span class="p">,</span> <span class="n">out</span><span class="o">=</span><span class="n">out</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div>


<span class="c1"># &#39;clip&#39;,</span>
<span class="c1"># &#39;compress&#39;,</span>

<div class="viewcode-block" id="dpnp_array.conj">
Expand Down Expand Up @@ -1393,15 +1381,23 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>

<div class="viewcode-block" id="dpnp_array.std">
<a class="viewcode-back" href="../../reference/generated/dpnp.dpnp_array.dpnp_array.html#dpnp.dpnp_array.dpnp_array.std">[docs]</a>
<span class="k">def</span> <span class="nf">std</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</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">out</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ddof</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns the variance of the array elements, along given axis.</span>

<span class="sd"> .. seealso::</span>
<span class="sd"> :obj:`dpnp.var` for full documentation,</span>
<span class="k">def</span> <span class="nf">std</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">axis</span><span class="o">=</span><span class="kc">None</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">out</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">ddof</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="o">*</span><span class="p">,</span>
<span class="n">where</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns the standard deviation of the array elements, along given axis.</span>

<span class="sd"> Refer to :obj:`dpnp.std` for full documentation.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">std</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">ddof</span><span class="p">,</span> <span class="n">keepdims</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">std</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">ddof</span><span class="p">,</span> <span class="n">keepdims</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">where</span><span class="p">)</span></div>


<span class="nd">@property</span>
Expand Down Expand Up @@ -1436,10 +1432,7 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns the sum along a given axis.</span>

<span class="sd"> .. seealso::</span>
<span class="sd"> :obj:`dpnp.sum` for full documentation,</span>
<span class="sd"> :meth:`dpnp.dparray.sum`</span>

<span class="sd"> For full documentation refer to :obj:`dpnp.sum`.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span>
Expand Down Expand Up @@ -1548,23 +1541,22 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>

<div class="viewcode-block" id="dpnp_array.var">
<a class="viewcode-back" href="../../reference/generated/dpnp.dpnp_array.dpnp_array.html#dpnp.dpnp_array.dpnp_array.var">[docs]</a>
<span class="k">def</span> <span class="nf">var</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</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">out</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ddof</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">var</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">axis</span><span class="o">=</span><span class="kc">None</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">out</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">ddof</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="o">*</span><span class="p">,</span>
<span class="n">where</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns the variance of the array elements along given axis.</span>

<span class="sd"> Masked entries are ignored, and result elements which are not</span>
<span class="sd"> finite will be masked.</span>

<span class="sd"> Refer to `numpy.var` for full documentation.</span>

<span class="sd"> See Also</span>
<span class="sd"> --------</span>
<span class="sd"> :obj:`numpy.ndarray.var` : corresponding function for ndarrays</span>
<span class="sd"> :obj:`numpy.var` : Equivalent function</span>
<span class="sd"> Returns the variance of the array elements, along given axis.</span>

<span class="sd"> Refer to :obj:`dpnp.var` for full documentation.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">ddof</span><span class="p">,</span> <span class="n">keepdims</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">ddof</span><span class="p">,</span> <span class="n">keepdims</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">where</span><span class="p">)</span></div>
</div>


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.13.1dev1+20.gc35d8b6fda documentation</title>
<title>dpnp.dpnp_flatiter &mdash; Data Parallel Extension for NumPy 0.13.1dev1+17.g996cf5405e 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=e64bcc3b"></script>
<script src="../../_static/documentation_options.js?v=e2b28984"></script>
<script src="../../_static/doctools.js?v=888ff710"></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.13.1dev1+20.gc35d8b6fda
0.13.1dev1+17.g996cf5405e
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
Loading

0 comments on commit 89f7f5d

Please sign in to comment.