Skip to content

Commit

Permalink
Added device keyword argument to astype function (#1870)
Browse files Browse the repository at this point in the history
* Added device keyword argument to astype function

* Added test for astype function

* address comments

---------

Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com> 38fd39d
  • Loading branch information
github-actions[bot] committed Jun 14, 2024
1 parent a73c33d commit 0894e5b
Show file tree
Hide file tree
Showing 493 changed files with 1,520 additions and 1,478 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: e7487660962c1190d4c5cda884885c1c
config: a1d42e122e11d78c6eea4ea9af0bdc0c
tags: 645f666f9bcd5a90fca523b33c5a78b7
27 changes: 22 additions & 5 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+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_array &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -707,7 +707,15 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>

<div class="viewcode-block" id="dpnp_array.astype">
<a class="viewcode-back" href="../../reference/generated/dpnp.dpnp_array.dpnp_array.html#dpnp.dpnp_array.dpnp_array.astype">[docs]</a>
<span class="k">def</span> <span class="nf">astype</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="s2">&quot;unsafe&quot;</span><span class="p">,</span> <span class="n">subok</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">astype</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">dtype</span><span class="p">,</span>
<span class="n">order</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span>
<span class="n">casting</span><span class="o">=</span><span class="s2">&quot;unsafe&quot;</span><span class="p">,</span>
<span class="n">subok</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">copy</span><span class="o">=</span><span class="kc">True</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="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Copy the array with data type casting.</span>

Expand Down Expand Up @@ -742,6 +750,13 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>
<span class="sd"> this is set to ``False``, and the `dtype`, `order`, and `subok`</span>
<span class="sd"> requirements are satisfied, the input array is returned instead of</span>
<span class="sd"> a copy.</span>
<span class="sd"> device : {None, string, SyclDevice, SyclQueue}, optional</span>
<span class="sd"> An array API concept of device where the output array is created.</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. Default: ``None``.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand Down Expand Up @@ -771,7 +786,9 @@ <h1>Source code for dpnp.dpnp_array</h1><div class="highlight"><pre>
<span class="sa">f</span><span class="s2">&quot;subok=</span><span class="si">{</span><span class="n">subok</span><span class="si">}</span><span class="s2"> is currently not supported&quot;</span>
<span class="p">)</span>

<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="n">casting</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="n">casting</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">device</span>
<span class="p">)</span></div>


<span class="c1"># &#39;base&#39;,</span>
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+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_flatiter &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
17 changes: 12 additions & 5 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+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_iface &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -278,7 +278,7 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
<span class="c1"># pylint: disable=redefined-outer-name</span>
<div class="viewcode-block" id="astype">
<a class="viewcode-back" href="../../reference/generated/dpnp.astype.html#dpnp.astype">[docs]</a>
<span class="k">def</span> <span class="nf">astype</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="s2">&quot;unsafe&quot;</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">astype</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="s2">&quot;unsafe&quot;</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</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="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Copy the array with data type casting.</span>

Expand Down Expand Up @@ -311,6 +311,13 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
<span class="sd"> By default, ``astype`` always returns a newly allocated array. If this</span>
<span class="sd"> is set to ``False``, and the `dtype`, `order`, and `subok` requirements</span>
<span class="sd"> are satisfied, the input array is returned instead of a copy.</span>
<span class="sd"> device : {None, string, SyclDevice, SyclQueue}, optional</span>
<span class="sd"> An array API concept of device where the output array is created.</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. Default: ``None``.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand All @@ -326,7 +333,7 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>

<span class="n">x1_obj</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">x1</span><span class="p">)</span>
<span class="n">array_obj</span> <span class="o">=</span> <span class="n">dpt</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span>
<span class="n">x1_obj</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="n">casting</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span>
<span class="n">x1_obj</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="n">casting</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</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="c1"># return x1 if dpctl returns a zero copy of x1_obj</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+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_iface_arraycreation &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</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+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_iface_counting &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</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_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+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_iface_histograms &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</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_indexing.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_indexing &mdash; Data Parallel Extension for NumPy 0.16.0dev0+16.g6a737c4991 documentation</title>
<title>dpnp.dpnp_iface_indexing &mdash; Data Parallel Extension for NumPy 0.16.0dev0+17.g38fd39debe 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=63b2c898"></script>
<script src="../../_static/documentation_options.js?v=55a8768f"></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+16.g6a737c4991
0.16.0dev0+17.g38fd39debe
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
Loading

0 comments on commit 0894e5b

Please sign in to comment.