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
<ddclass="field-even"><p><strong>out</strong> (<em>List[array]</em>) – a list of broadcasted arrays. Each array must have the same shape. Each array must have the same dtype as its corresponding input array.</p>
481
+
<ddclass="field-even"><p><strong>out</strong> (<em>List[array]</em>) – a list of broadcasted arrays. Each array <strong>must</strong> have the same shape. Each array <strong>must</strong> have the same dtype as its corresponding input array.</p>
<li><p><strong>x</strong> (<em>array</em>) – array to broadcast. Must be capable of being broadcast to the specified <codeclass="docutils literal notranslate"><spanclass="pre">shape</span></code> (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). If the array is incompatible with the specified shape, the function must raise an exception.</p></li>
479
+
<li><p><strong>x</strong> (<em>array</em>) – array to broadcast. <strong>Must</strong> be capable of being broadcast to the specified <codeclass="docutils literal notranslate"><spanclass="pre">shape</span></code> (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). If the array is incompatible with the specified shape, the function <strong>must</strong> raise an exception.</p></li>
<li><p><strong>out</strong> (<em>array</em>) – an array having the specified shape. Must have the same data type as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p></li>
485
+
<li><p><strong>out</strong> (<em>array</em>) – an array having the specified shape. <strong>Must</strong> have the same data type as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p></li>
<li><p><strong>arrays</strong> (<em>Union</em><em>[</em><em>Tuple</em><em>[</em><em>array</em><em>, </em><em>...</em><em>]</em><em>, </em><em>List</em><em>[</em><em>array</em><em>]</em><em>]</em>) – input arrays to join. The arrays must have the same shape, except in the dimension specified by <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>.</p></li>
480
-
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – axis along which the arrays will be joined. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, arrays must be flattened before concatenation. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is negative, the function must determine the axis along which to join by counting from the last dimension. Default: <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>.</p></li>
479
+
<li><p><strong>arrays</strong> (<em>Union</em><em>[</em><em>Tuple</em><em>[</em><em>array</em><em>, </em><em>...</em><em>]</em><em>, </em><em>List</em><em>[</em><em>array</em><em>]</em><em>]</em>) – input arrays to join. The arrays <strong>must</strong> have the same shape, except in the dimension specified by <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>.</p></li>
480
+
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – axis along which to join the arrays. A valid axis <strong>must</strong> be an integer on the interval <codeclass="docutils literal notranslate"><spanclass="pre">[-N,</span><spanclass="pre">N)</span></code>, where <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code> is the number of axes in each array. If an axis is specified as a negative integer, the function <strong>must</strong> determine the axis along which to perform the operation by counting backward from the last axis (where <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code> refers to the last axis). If provided an invalid axis, the function <strong>must</strong> raise an exception. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, arrays <strong>must</strong> be flattened before concatenation. Default: <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an output array containing the concatenated values. If the input arrays have different data types, normal <aclass="reference internal" href="../type_promotion.html#type-promotion"><spanclass="std std-ref">Type Promotion Rules</span></a> must apply. If the input arrays have the same data type, the output array must have the same data type as the input arrays.</p>
484
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an output array containing the concatenated values. If the input arrays have different data types, normal <aclass="reference internal" href="../type_promotion.html#type-promotion"><spanclass="std std-ref">Type Promotion Rules</span></a><strong>must</strong> apply. If the input arrays have the same data type, the output array <strong>must</strong> have the same data type as the input arrays.</p>
485
485
<divclass="admonition note">
486
486
<pclass="admonition-title">Note</p>
487
-
<p>This specification leaves type promotion between data type families (i.e., <codeclass="docutils literal notranslate"><spanclass="pre">intxx</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">floatxx</span></code>) unspecified.</p>
487
+
<p>This specification leaves type promotion between data type families (i.e., <codeclass="docutils literal notranslate"><spanclass="pre">intxx</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">floatxx</span></code>) unspecified and thus implementation-defined.</p>
<spanclass="sig-name descname"><spanclass="pre">expand_dims</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">x</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">array</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">/</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">axis</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">int</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">0</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">array</span></span></span><aclass="headerlink" href="#array_api.expand_dims" title="Link to this definition">¶</a></dt>
475
-
<dd><p>Expands the shape of an array by inserting a new axis (dimension) of size one at the position specified by <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>.</p>
475
+
<dd><p>Expands the shape of an array by inserting a new axis of size one at the position specified by <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>.</p>
<li><p><strong>axis</strong> (<em>int</em>) – axis position (zero-based). If <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has rank (i.e, number of dimensions) <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code>, a valid <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> must reside on the closed-interval <codeclass="docutils literal notranslate"><spanclass="pre">[-N-1,</span><spanclass="pre">N]</span></code>. If provided a negative <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>, the axis position at which to insert a singleton dimension must be computed as <codeclass="docutils literal notranslate"><spanclass="pre">N</span><spanclass="pre">+</span><spanclass="pre">axis</span><spanclass="pre">+</span><spanclass="pre">1</span></code>. Hence, if provided <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>, the resolved axis position must be <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code> (i.e., a singleton dimension must be appended to the input array <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>). If provided <codeclass="docutils literal notranslate"><spanclass="pre">-N-1</span></code>, the resolved axis position must be <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> (i.e., a singleton dimension must be prepended to the input array <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>).</p></li>
480
+
<li><p><strong>axis</strong> (<em>int</em>) – axis position (zero-based). A valid <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code><strong>must</strong> reside on the closed-interval <codeclass="docutils literal notranslate"><spanclass="pre">[-N-1,</span><spanclass="pre">N]</span></code>, where <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code> is the number of axes in <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>. If an axis is specified as a negative integer, the axis position at which to insert a singleton dimension <strong>must</strong> be computed as <codeclass="docutils literal notranslate"><spanclass="pre">N</span><spanclass="pre">+</span><spanclass="pre">axis</span><spanclass="pre">+</span><spanclass="pre">1</span></code>. Hence, if provided <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>, the resolved axis position <strong>must</strong> be <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code> (i.e., a singleton dimension <strong>must</strong> be appended to the input array <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>). If provided <codeclass="docutils literal notranslate"><spanclass="pre">-N-1</span></code>, the resolved axis position <strong>must</strong> be <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> (i.e., a singleton dimension <strong>must</strong> be prepended to the input array <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>). If provided an invalid axis, the function <strong>must</strong> raise an exception. Default: <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an expanded output array having the same data type as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p>
484
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an expanded output array. <strong>Must</strong> have the same data type as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p>
<ddclass="field-odd"><p><strong>IndexError</strong> – If provided an invalid <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> position, an <codeclass="docutils literal notranslate"><spanclass="pre">IndexError</span></code> should be raised.</p>
487
+
<ddclass="field-odd"><p><strong>IndexError</strong> – If provided an invalid <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>, an <codeclass="docutils literal notranslate"><spanclass="pre">IndexError</span></code><strong>should</strong> be raised.</p>
<spanclass="sig-name descname"><spanclass="pre">flip</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">x</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">array</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">/</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">axis</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">int</span><spanclass="w"></span><spanclass="p"><spanclass="pre">|</span></span><spanclass="w"></span><spanclass="pre">Tuple</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">int</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="p"><spanclass="pre">...</span></span><spanclass="p"><spanclass="pre">]</span></span><spanclass="w"></span><spanclass="p"><spanclass="pre">|</span></span><spanclass="w"></span><spanclass="pre">None</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">array</span></span></span><aclass="headerlink" href="#array_api.flip" title="Link to this definition">¶</a></dt>
475
-
<dd><p>Reverses the order of elements in an array along the given axis. The shape of the array must be preserved.</p>
475
+
<dd><p>Reverses the order of elements in an array along the given axis.</p>
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>Union</em><em>[</em><em>int</em><em>, </em><em>Tuple</em><em>[</em><em>int</em><em>, </em><em>...</em><em>]</em><em>]</em><em>]</em>) – axis (or axes) along which to flip. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must flip all input array axes. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is negative, the function must count from the last dimension. If provided more than one axis, the function must flip only the specified axes. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
480
+
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>Union</em><em>[</em><em>int</em><em>, </em><em>Tuple</em><em>[</em><em>int</em><em>, </em><em>...</em><em>]</em><em>]</em><em>]</em>) – axis (or axes) along which to reverse elements. A valid axis <strong>must</strong> be an integer on the interval <codeclass="docutils literal notranslate"><spanclass="pre">[-N,</span><spanclass="pre">N)</span></code>, where <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code> is the number of axes in <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>. If an axis is specified as a negative integer, the function <strong>must</strong> determine the axis along which to perform the operation by counting backward from the last axis (where <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code> refers to the last axis). If provided an invalid axis, the function <strong>must</strong> raise an exception. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function <strong>must</strong> flip all input array axes. If provided more than one axis, the function <strong>must</strong> flip only the specified axes. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an output array having the same data type and shape as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> and whose elements, relative to <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, are reordered.</p>
484
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an output array. The returned array <strong>must</strong> have the same data type and shape as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>. The returned array must have the same elements as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, but which are reordered relative to <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p>
0 commit comments