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
<li><p><strong>x</strong> (<em>array</em>) – input array. Should have one or more dimensions (axes). Should have a numeric data type.</p></li>
480
-
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – <p>axis along which a cumulative productmust be computed. If <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>is negative, the function must determine the axis along which to compute a cumulative product by counting from the last dimension.</p>
481
-
<p>If <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> is a one-dimensional array, providing an <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>is optional; however, if <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has more than one dimension, providing an <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code>is required.</p>
479
+
<li><p><strong>x</strong> (<em>array</em>) – input array. <strong>Should</strong> have one or more dimensions (axes). <strong>Should</strong> have a numeric data type.</p></li>
480
+
<li><p><strong>axis</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – <p>axis along which to compute the cumulative product. 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.</p>
481
+
<p>If <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> is a one-dimensional array, providing an <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code><strong>must</strong> be optional; however, if <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has more than one dimension, providing an <codeclass="docutils literal notranslate"><spanclass="pre">axis</span></code><strong>must</strong> be required.</p>
482
482
</p></li>
483
-
<li><p><strong>dtype</strong> (<em>Optional</em><em>[</em><em>dtype</em><em>]</em>) – <p>data type of the returned array. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the returned array must have the same data type as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, unless <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has an integer data type supporting a smaller range of values than the default integer data type (e.g., <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has an <codeclass="docutils literal notranslate"><spanclass="pre">int16</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">uint32</span></code> data type and the default integer data type is <codeclass="docutils literal notranslate"><spanclass="pre">int64</span></code>). In those latter cases:</p>
483
+
<li><p><strong>dtype</strong> (<em>Optional</em><em>[</em><em>dtype</em><em>]</em>) – <p>data type of the returned array. If <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the returned array <strong>must</strong> have the same data type as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, unless <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has an integer data type supporting a smaller range of values than the default integer data type (e.g., <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has an <codeclass="docutils literal notranslate"><spanclass="pre">int16</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">uint32</span></code> data type and the default integer data type is <codeclass="docutils literal notranslate"><spanclass="pre">int64</span></code>). In those latter cases:</p>
484
484
<ul>
485
-
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has a signed integer data type (e.g., <codeclass="docutils literal notranslate"><spanclass="pre">int16</span></code>), the returned array must have the default integer data type.</p></li>
486
-
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has an unsigned integer data type (e.g., <codeclass="docutils literal notranslate"><spanclass="pre">uint16</span></code>), the returned array must have an unsigned integer data type having the same number of bits as the default integer data type (e.g., if the default integer data type is <codeclass="docutils literal notranslate"><spanclass="pre">int32</span></code>, the returned array must have a <codeclass="docutils literal notranslate"><spanclass="pre">uint32</span></code> data type).</p></li>
485
+
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has a signed integer data type (e.g., <codeclass="docutils literal notranslate"><spanclass="pre">int16</span></code>), the returned array <strong>must</strong> have the default integer data type.</p></li>
486
+
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> has an unsigned integer data type (e.g., <codeclass="docutils literal notranslate"><spanclass="pre">uint16</span></code>), the returned array <strong>must</strong> have an unsigned integer data type having the same number of bits as the default integer data type (e.g., if the default integer data type is <codeclass="docutils literal notranslate"><spanclass="pre">int32</span></code>, the returned array <strong>must</strong> have a <codeclass="docutils literal notranslate"><spanclass="pre">uint32</span></code> data type).</p></li>
487
487
</ul>
488
-
<p>If the data type (either specified or resolved) differs from the data type of <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, the input array should be cast to the specified data type before computing the product (rationale: the <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> keyword argument is intended to help prevent overflows). Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
488
+
<p>If the data type (either specified or resolved) differs from the data type of <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, the input array <strong>should</strong> be cast to the specified data type before computing the product (rationale: the <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> keyword argument is intended to help prevent overflows). Default: <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
489
489
</p></li>
490
-
<li><p><strong>include_initial</strong> (<em>bool</em>) – boolean indicating whether to include the initial value as the first value in the output. By convention, the initial value must be the multiplicative identity (i.e., one). Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
490
+
<li><p><strong>include_initial</strong> (<em>bool</em>) – boolean indicating whether to include the initial value as the first value in the output. By convention, the initial value <strong>must</strong> be the multiplicative identity (i.e., one). Default: <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>.</p></li>
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an array containing the cumulative products. The returned array must have a data type as described by the <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> parameter above.</p>
495
-
<p>Let <codeclass="docutils literal notranslate"><spanclass="pre">N</span></code> be the size of the axis along which to compute the cumulative product. The returned array must have a shape determined according to the following rules:</p>
494
+
<ddclass="field-even"><p><strong>out</strong> (<em>array</em>) – an array containing the cumulative products. The returned array <strong>must</strong> have a data type as described by the <codeclass="docutils literal notranslate"><spanclass="pre">dtype</span></code> parameter above.</p>
495
+
<p>Let <codeclass="docutils literal notranslate"><spanclass="pre">M</span></code> be the size of the axis along which to compute the cumulative product. The returned array <strong>must</strong> have a shape determined according to the following rules:</p>
496
496
<ulclass="simple">
497
-
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">include_initial</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the returned array must have the same shape as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, except the size of the axis along which to compute the cumulative product must be <codeclass="docutils literal notranslate"><spanclass="pre">N+1</span></code>.</p></li>
498
-
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">include_initial</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the returned array must have the same shape as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p></li>
497
+
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">include_initial</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, the returned array <strong>must</strong> have the same shape as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>, except the size of the axis along which to compute the cumulative product <strong>must</strong> be <codeclass="docutils literal notranslate"><spanclass="pre">M+1</span></code>.</p></li>
498
+
<li><p>if <codeclass="docutils literal notranslate"><spanclass="pre">include_initial</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, the returned array <strong>must</strong> have the same shape as <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code>.</p></li>
<li><p>When <codeclass="docutils literal notranslate"><spanclass="pre">x</span></code> is a zero-dimensional array, behavior is unspecified and thus implementation-defined.</p></li>
505
505
</ul>
506
506
<p><strong>Special Cases</strong></p>
507
-
<p>For both real-valued and complex floating-point operands, special cases must be handled as if the operation is implemented by successive application of <aclass="reference internal" href="array_api.multiply.html#array_api.multiply" title="array_api.multiply"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">multiply()</span></code></a>.</p>
507
+
<p>For both real-valued and complex floating-point operands, special cases <strong>must</strong> be handled as if the operation is implemented by successive application of <aclass="reference internal" href="array_api.multiply.html#array_api.multiply" title="array_api.multiply"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">multiply()</span></code></a>.</p>
508
508
<divclass="versionadded">
509
509
<p><spanclass="versionmodified added">New in version 2024.12.</span></p>
0 commit comments