-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
df8df1a
commit 85c11b6
Showing
1,742 changed files
with
217,480 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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: df4e043b89a4a8dcc4298d6aa23adc85 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
4,175 changes: 4,175 additions & 0 deletions
4,175
pull/2244/_modules/dpnp/dpnp_iface_arraycreation.html
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<!-- Google tag (gtag.js) --> | ||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-554F8VNE28"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', 'G-554F8VNE28'); | ||
</script> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>dpnp.dpnp_iface_counting — Data Parallel Extension for NumPy 0.16.2+4.g77e845cd687 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=e59714d7" /> | ||
|
||
|
||
<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=9d065e87"></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> | ||
<link rel="index" title="Index" href="../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../../index.html" class="icon icon-home"> | ||
Data Parallel Extension for NumPy | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../overview.html">Overview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../quick_start_guide.html">Quick Start Guide</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../reference/index.html">API Reference</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">Development information</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../dpnp_backend_api.html">C++ backend API Reference</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../index.html">Data Parallel Extension for NumPy</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">dpnp.dpnp_iface_counting</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for dpnp.dpnp_iface_counting</h1><div class="highlight"><pre> | ||
<span></span><span class="c1"># -*- coding: utf-8 -*-</span> | ||
<span class="c1"># *****************************************************************************</span> | ||
<span class="c1"># Copyright (c) 2016-2024, Intel Corporation</span> | ||
<span class="c1"># All rights reserved.</span> | ||
<span class="c1">#</span> | ||
<span class="c1"># Redistribution and use in source and binary forms, with or without</span> | ||
<span class="c1"># modification, are permitted provided that the following conditions are met:</span> | ||
<span class="c1"># - Redistributions of source code must retain the above copyright notice,</span> | ||
<span class="c1"># this list of conditions and the following disclaimer.</span> | ||
<span class="c1"># - Redistributions in binary form must reproduce the above copyright notice,</span> | ||
<span class="c1"># this list of conditions and the following disclaimer in the documentation</span> | ||
<span class="c1"># and/or other materials provided with the distribution.</span> | ||
<span class="c1">#</span> | ||
<span class="c1"># THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</span> | ||
<span class="c1"># AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> | ||
<span class="c1"># IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> | ||
<span class="c1"># ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE</span> | ||
<span class="c1"># LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span> | ||
<span class="c1"># CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span> | ||
<span class="c1"># SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span> | ||
<span class="c1"># INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span> | ||
<span class="c1"># CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span> | ||
<span class="c1"># ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF</span> | ||
<span class="c1"># THE POSSIBILITY OF SUCH DAMAGE.</span> | ||
<span class="c1"># *****************************************************************************</span> | ||
|
||
<span class="sd">"""</span> | ||
<span class="sd">Interface of the counting function of the dpnp</span> | ||
|
||
<span class="sd">Notes</span> | ||
<span class="sd">-----</span> | ||
<span class="sd">This module is a face or public interface file for the library</span> | ||
<span class="sd">it contains:</span> | ||
<span class="sd"> - Interface functions</span> | ||
<span class="sd"> - documentation for the functions</span> | ||
<span class="sd"> - The functions parameters check</span> | ||
|
||
<span class="sd">"""</span> | ||
|
||
<span class="kn">import</span> <span class="nn">dpctl.tensor</span> <span class="k">as</span> <span class="nn">dpt</span> | ||
|
||
<span class="kn">import</span> <span class="nn">dpnp</span> | ||
|
||
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"count_nonzero"</span><span class="p">]</span> | ||
|
||
|
||
<div class="viewcode-block" id="count_nonzero"> | ||
<a class="viewcode-back" href="../../reference/generated/dpnp.count_nonzero.html#dpnp.count_nonzero">[docs]</a> | ||
<span class="k">def</span> <span class="nf">count_nonzero</span><span class="p">(</span><span class="n">a</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="o">*</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="n">out</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Counts the number of non-zero values in the array `a`.</span> | ||
|
||
<span class="sd"> For full documentation refer to :obj:`numpy.count_nonzero`.</span> | ||
|
||
<span class="sd"> Parameters</span> | ||
<span class="sd"> ----------</span> | ||
<span class="sd"> a : {dpnp.ndarray, usm_ndarray}</span> | ||
<span class="sd"> The array for which to count non-zeros.</span> | ||
<span class="sd"> axis : {None, int, tuple}, optional</span> | ||
<span class="sd"> Axis or tuple of axes along which to count non-zeros.</span> | ||
<span class="sd"> Default value means that non-zeros will be counted along a flattened</span> | ||
<span class="sd"> version of `a`.</span> | ||
<span class="sd"> Default: ``None``.</span> | ||
<span class="sd"> keepdims : bool, optional</span> | ||
<span class="sd"> If this is set to ``True``, the axes that are counted are left in the</span> | ||
<span class="sd"> result as dimensions with size one. With this option, the result will</span> | ||
<span class="sd"> broadcast correctly against the input array.</span> | ||
<span class="sd"> Default: ``False``.</span> | ||
<span class="sd"> out : {None, dpnp.ndarray, usm_ndarray}, optional</span> | ||
<span class="sd"> The array into which the result is written. The data type of `out` must</span> | ||
<span class="sd"> match the expected shape and the expected data type of the result.</span> | ||
<span class="sd"> If ``None`` then a new array is returned.</span> | ||
<span class="sd"> Default: ``None``.</span> | ||
|
||
<span class="sd"> Returns</span> | ||
<span class="sd"> -------</span> | ||
<span class="sd"> out : dpnp.ndarray</span> | ||
<span class="sd"> Number of non-zero values in the array along a given axis.</span> | ||
<span class="sd"> Otherwise, a zero-dimensional array with the total number of non-zero</span> | ||
<span class="sd"> values in the array is returned.</span> | ||
|
||
<span class="sd"> See Also</span> | ||
<span class="sd"> --------</span> | ||
<span class="sd"> :obj:`dpnp.nonzero` : Return the coordinates of all the non-zero values.</span> | ||
|
||
<span class="sd"> Examples</span> | ||
<span class="sd"> --------</span> | ||
<span class="sd"> >>> import dpnp as np</span> | ||
<span class="sd"> >>> np.count_nonzero(np.eye(4))</span> | ||
<span class="sd"> array(4)</span> | ||
<span class="sd"> >>> a = np.array([[0, 1, 7, 0],</span> | ||
<span class="sd"> [3, 0, 2, 19]])</span> | ||
<span class="sd"> >>> np.count_nonzero(a)</span> | ||
<span class="sd"> array(5)</span> | ||
<span class="sd"> >>> np.count_nonzero(a, axis=0)</span> | ||
<span class="sd"> array([1, 1, 2, 1])</span> | ||
<span class="sd"> >>> np.count_nonzero(a, axis=1)</span> | ||
<span class="sd"> array([2, 3])</span> | ||
<span class="sd"> >>> np.count_nonzero(a, axis=1, keepdims=True)</span> | ||
<span class="sd"> array([[2],</span> | ||
<span class="sd"> [3]])</span> | ||
|
||
<span class="sd"> """</span> | ||
|
||
<span class="n">usm_a</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">a</span><span class="p">)</span> | ||
<span class="n">usm_out</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">out</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">get_usm_ndarray</span><span class="p">(</span><span class="n">out</span><span class="p">)</span> | ||
|
||
<span class="n">usm_res</span> <span class="o">=</span> <span class="n">dpt</span><span class="o">.</span><span class="n">count_nonzero</span><span class="p">(</span> | ||
<span class="n">usm_a</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="n">keepdims</span><span class="p">,</span> <span class="n">out</span><span class="o">=</span><span class="n">usm_out</span> | ||
<span class="p">)</span> | ||
<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">get_result_array</span><span class="p">(</span><span class="n">usm_res</span><span class="p">,</span> <span class="n">out</span><span class="p">)</span></div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2020-2024, Intel Corporation.</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.