You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h3id="in-place-operators">In-place Operators<aclass="headerlink" href="#in-place-operators" title="Link to this heading">¶</a></h3>
728
728
<divclass="admonition note">
729
729
<pclass="admonition-title">Note</p>
730
-
<p>In-place operations must be supported as discussed in <aclass="reference internal" href="../design_topics/copies_views_and_mutation.html#copyview-mutability"><spanclass="std std-ref">Copy-view behaviour and mutability</span></a>.</p>
730
+
<p>In-place operations must be supported as discussed in <aclass="reference internal" href="../design_topics/copies_views_and_mutation.html#copyview-mutability"><spanclass="std std-ref">Copy-view behavior and mutability</span></a>.</p>
731
731
</div>
732
732
<p>A conforming implementation of the array API standard must provide and support an array object supporting the following “in-place” Python operators.</p>
<li><p><strong>copy</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – <p>boolean indicating whether or not to copy the input. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the
530
-
function must always copy (performed by the producer). If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the
530
+
function must always copy (performed by the producer; see also <aclass="reference internal" href="../../design_topics/copies_views_and_mutation.html#copy-keyword-argument"><spanclass="std std-ref">Copy keyword argument behavior</span></a>). If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the
531
531
function must never copy, and raise a <codeclass="docutils literal notranslate"><spanclass="pre">BufferError</span></code> in case a copy is
532
532
deemed necessary (e.g. if a cross-device data movement is requested, and
533
533
it is not possible without a copy). If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must reuse
<li><p><strong>device</strong> (<em>Optional</em><em>[</em><em>device</em><em>]</em>) – device on which to place the created array. If <codeclass="docutils literal notranslate"><spanclass="pre">device</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">obj</span></code> is an array, the output array device must be inferred from <codeclass="docutils literal notranslate"><spanclass="pre">obj</span></code>. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
496
-
<li><p><strong>copy</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – boolean indicating whether or not to copy the input. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the function must always copy. If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the function must never copy for input which supports the buffer protocol and must raise a <codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> in case a copy would be necessary. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must reuse existing memory buffer if possible and copy otherwise. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
496
+
<li><p><strong>copy</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – boolean indicating whether or not to copy the input. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the function must always copy (see <aclass="reference internal" href="../../design_topics/copies_views_and_mutation.html#copy-keyword-argument"><spanclass="std std-ref">Copy keyword argument behavior</span></a>). If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the function must never copy for input which supports the buffer protocol and must raise a <codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> in case a copy would be necessary. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must reuse existing memory buffer if possible and copy otherwise. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
<li><p><strong>x</strong> (<em>array</em>) – array to cast.</p></li>
492
492
<li><p><strong>dtype</strong> (<em>dtype</em>) – desired data type.</p></li>
493
-
<li><p><strong>copy</strong> (<em>bool</em>) – specifies whether to copy an array when the specified <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> matches the data type of the input array <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, a newly allocated array must always be returned. If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code> and the specified <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> matches the data type of the input array, the input array must be returned; otherwise, a newly allocated array must be returned. Default: <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p></li>
493
+
<li><p><strong>copy</strong> (<em>bool</em>) – specifies whether to copy an array when the specified <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> matches the data type of the input array <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, a newly allocated array must always be returned (see <aclass="reference internal" href="../../design_topics/copies_views_and_mutation.html#copy-keyword-argument"><spanclass="std std-ref">Copy keyword argument behavior</span></a>). If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code> and the specified <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> matches the data type of the input array, the input array must be returned; otherwise, a newly allocated array must be returned. Default: <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p></li>
494
494
<li><p><strong>device</strong> (<em>Optional</em><em>[</em><em>device</em><em>]</em>) – device on which to place the returned array. If <codeclass="docutils literal notranslate"><spanclass="pre">device</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the output array device must be inferred from <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
<li><p><strong>x</strong> (<em>array</em>) – input array to reshape.</p></li>
473
473
<li><p><strong>shape</strong> (<em>Tuple</em><em>[</em><em>int</em><em>, </em><em>...</em><em>]</em>) – a new shape compatible with the original shape. One shape dimension is allowed to be <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>. When a shape dimension is <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>, the corresponding output array shape dimension must be inferred from the length of the array and the remaining dimensions.</p></li>
474
-
<li><p><strong>copy</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – whether or not to copy the input array. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the function must always copy. If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the function must never copy. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must avoid copying, if possible, and may copy otherwise. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
474
+
<li><p><strong>copy</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – whether or not to copy the input array. If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the function must always copy (see <aclass="reference internal" href="../../design_topics/copies_views_and_mutation.html#copy-keyword-argument"><spanclass="std std-ref">Copy keyword argument behavior</span></a>). If <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the function must never copy. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must avoid copying, if possible, and may copy otherwise. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
0 commit comments