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
<spanclass="sig-name descname"><spanclass="pre">argmax</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">None</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">keepdims</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">False</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.argmax" title="Link to this definition">¶</a></dt>
475
475
<dd><p>Returns the indices of the maximum values along a specified axis.</p>
476
476
<p>When the maximum value occurs multiple times, only the indices corresponding to the first occurrence are returned.</p>
477
-
<divclass="admonition note">
478
-
<pclass="admonition-title">Note</p>
479
-
<p>For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see <aclass="reference internal" href="../../design_topics/complex_numbers.html#complex-number-ordering"><spanclass="std std-ref">Complex Number Ordering</span></a>).</p>
<li><p><strong>x</strong> (<em>array</em>) – input array. Should have a real-valued data type.</p></li>
485
-
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – axis along which to search. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must return the index of the maximum value of the flattened array. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
486
-
<li><p><strong>keepdims</strong> (<em>bool</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). Otherwise, if <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the reduced axes (dimensions) must not be included in the result. Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
480
+
<li><p><strong>x</strong> (<em>array</em>) – input array. <strong>Should</strong> have a real-valued data type.</p></li>
481
+
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – axis along which to search. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function <strong>must</strong> return the index of the maximum value of the flattened array. If not <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, 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. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
482
+
<li><p><strong>keepdims</strong> (<em>bool</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the reduced axes <strong>must</strong> be included in the result as singleton dimensions, and, accordingly, the result <strong>must</strong> be broadcast-compatible with the input array (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). Otherwise, if <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the reduced axes <strong>must not</strong> be included in the result. Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, a zero-dimensional array containing the index of the first occurrence of the maximum value; otherwise, a non-zero-dimensional array containing the indices of the maximum values. The returned array must have be the default array index data type.</p>
486
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, a zero-dimensional array containing the index of the first occurrence of the maximum value; otherwise, a non-zero-dimensional array containing the indices of the maximum values. The returned array <strong>must</strong> have be the default array index data type.</p>
491
487
</dd>
492
488
</dl>
489
+
<pclass="rubric">Notes</p>
490
+
<ulclass="simple">
491
+
<li><p>For backward compatibility, conforming implementations <strong>may</strong> support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see <aclass="reference internal" href="../../design_topics/complex_numbers.html#complex-number-ordering"><spanclass="std std-ref">Complex Number Ordering</span></a>).</p></li>
<spanclass="sig-name descname"><spanclass="pre">argmin</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">None</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">keepdims</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">False</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.argmin" title="Link to this definition">¶</a></dt>
475
475
<dd><p>Returns the indices of the minimum values along a specified axis.</p>
476
476
<p>When the minimum value occurs multiple times, only the indices corresponding to the first occurrence are returned.</p>
477
-
<divclass="admonition note">
478
-
<pclass="admonition-title">Note</p>
479
-
<p>For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see <aclass="reference internal" href="../../design_topics/complex_numbers.html#complex-number-ordering"><spanclass="std std-ref">Complex Number Ordering</span></a>).</p>
<li><p><strong>x</strong> (<em>array</em>) – input array. Should have a real-valued data type.</p></li>
485
-
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – axis along which to search. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function must return the index of the minimum value of the flattened array. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
486
-
<li><p><strong>keepdims</strong> (<em>bool</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). Otherwise, if <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the reduced axes (dimensions) must not be included in the result. Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
480
+
<li><p><strong>x</strong> (<em>array</em>) – input array. <strong>Should</strong> have a real-valued data type.</p></li>
481
+
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – axis along which to search. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the function <strong>must</strong> return the index of the minimum value of the flattened array. If not <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, 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. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
482
+
<li><p><strong>keepdims</strong> (<em>bool</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the reduced axes <strong>must</strong> be included in the result as singleton dimensions, and, accordingly, the result <strong>must</strong> be broadcast-compatible with the input array (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). Otherwise, if <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the reduced axes <strong>must not</strong> be included in the result. Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, a zero-dimensional array containing the index of the first occurrence of the minimum value; otherwise, a non-zero-dimensional array containing the indices of the minimum values. The returned array must have the default array index data type.</p>
486
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, a zero-dimensional array containing the index of the first occurrence of the minimum value; otherwise, a non-zero-dimensional array containing the indices of the minimum values. The returned array <strong>must</strong> have the default array index data type.</p>
491
487
</dd>
492
488
</dl>
489
+
<pclass="rubric">Notes</p>
490
+
<ulclass="simple">
491
+
<li><p>For backward compatibility, conforming implementations <strong>may</strong> support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see <aclass="reference internal" href="../../design_topics/complex_numbers.html#complex-number-ordering"><spanclass="std std-ref">Complex Number Ordering</span></a>).</p></li>
<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 count non-zero values. By default, the number of non-zero values must be computed over the entire array. If a tuple of integers, the number of non-zero values must be computed over multiple axes. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
481
-
<li><p><strong>keepdims</strong> (<em>bool</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). Otherwise, if <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the reduced axes (dimensions) must not be included in the result. Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</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 count non-zero values. By default, the number of non-zero values must be computed over the entire array. If a tuple of integers, the number of non-zero values must be computed over multiple axes. 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. Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
481
+
<li><p><strong>keepdims</strong> (<em>bool</em>) – if <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the reduced axes <strong>must</strong> be included in the result as singleton dimensions, and, accordingly, the result <strong>must</strong> be broadcast-compatible with the input array (see <aclass="reference internal" href="../broadcasting.html#broadcasting"><spanclass="std std-ref">Broadcasting</span></a>). Otherwise, if <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the reduced axes <strong>must not</strong> be included in the result. Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – if the number of non-zeros values was computed over the entire array, a zero-dimensional array containing the total number of non-zero values; otherwise, a non-zero-dimensional array containing the counts along the specified axes. The returned array must have the default array index data type.</p>
485
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – if the number of non-zeros values was computed over the entire array, a zero-dimensional array containing the total number of non-zero values; otherwise, a non-zero-dimensional array containing the counts along the specified axes. The returned array <strong>must</strong> have the default array index data type.</p>
0 commit comments