CINXE.COM
NumPy ops
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Keras documentation"> <meta name="author" content="Keras Team"> <link rel="shortcut icon" href="https://keras.io/img/favicon.ico"> <link rel="canonical" href="https://keras.io/api/ops/numpy/" /> <!-- Social --> <meta property="og:title" content="Keras documentation: NumPy ops"> <meta property="og:image" content="https://keras.io/img/logo-k-keras-wb.png"> <meta name="twitter:title" content="Keras documentation: NumPy ops"> <meta name="twitter:image" content="https://keras.io/img/k-keras-social.png"> <meta name="twitter:card" content="summary"> <title>NumPy ops</title> <!-- Bootstrap core CSS --> <link href="/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom fonts for this template --> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap" rel="stylesheet"> <!-- Custom styles for this template --> <link href="/css/docs.css" rel="stylesheet"> <link href="/css/monokai.css" rel="stylesheet"> <!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-5DNGF4N'); </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-175165319-128', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Tag Manager --> <script async defer src="https://buttons.github.io/buttons.js"></script> </head> <body> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5DNGF4N" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <div class='k-page'> <div class="k-nav" id="nav-menu"> <a href='/'><img src='/img/logo-small.png' class='logo-small' /></a> <div class="nav flex-column nav-pills" role="tablist" aria-orientation="vertical"> <a class="nav-link" href="/about/" role="tab" aria-selected="">About Keras</a> <a class="nav-link" href="/getting_started/" role="tab" aria-selected="">Getting started</a> <a class="nav-link" href="/guides/" role="tab" aria-selected="">Developer guides</a> <a class="nav-link" href="/examples/" role="tab" aria-selected="">Code examples</a> <a class="nav-link active" href="/api/" role="tab" aria-selected="">Keras 3 API documentation</a> <a class="nav-sublink" href="/api/models/">Models API</a> <a class="nav-sublink" href="/api/layers/">Layers API</a> <a class="nav-sublink" href="/api/callbacks/">Callbacks API</a> <a class="nav-sublink active" href="/api/ops/">Ops API</a> <a class="nav-sublink2 active" href="/api/ops/numpy/">NumPy ops</a> <a class="nav-sublink2" href="/api/ops/nn/">NN ops</a> <a class="nav-sublink2" href="/api/ops/linalg/">Linear algebra ops</a> <a class="nav-sublink2" href="/api/ops/core/">Core ops</a> <a class="nav-sublink2" href="/api/ops/image/">Image ops</a> <a class="nav-sublink2" href="/api/ops/fft/">FFT ops</a> <a class="nav-sublink" href="/api/optimizers/">Optimizers</a> <a class="nav-sublink" href="/api/metrics/">Metrics</a> <a class="nav-sublink" href="/api/losses/">Losses</a> <a class="nav-sublink" href="/api/data_loading/">Data loading</a> <a class="nav-sublink" href="/api/datasets/">Built-in small datasets</a> <a class="nav-sublink" href="/api/applications/">Keras Applications</a> <a class="nav-sublink" href="/api/mixed_precision/">Mixed precision</a> <a class="nav-sublink" href="/api/distribution/">Multi-device distribution</a> <a class="nav-sublink" href="/api/random/">RNG API</a> <a class="nav-sublink" href="/api/utils/">Utilities</a> <a class="nav-link" href="/2.18/api/" role="tab" aria-selected="">Keras 2 API documentation</a> <a class="nav-link" href="/keras_tuner/" role="tab" aria-selected="">KerasTuner: Hyperparam Tuning</a> <a class="nav-link" href="/keras_hub/" role="tab" aria-selected="">KerasHub: Pretrained Models</a> </div> </div> <div class='k-main'> <div class='k-main-top'> <script> function displayDropdownMenu() { e = document.getElementById("nav-menu"); if (e.style.display == "block") { e.style.display = "none"; } else { e.style.display = "block"; document.getElementById("dropdown-nav").style.display = "block"; } } function resetMobileUI() { if (window.innerWidth <= 840) { document.getElementById("nav-menu").style.display = "none"; document.getElementById("dropdown-nav").style.display = "block"; } else { document.getElementById("nav-menu").style.display = "block"; document.getElementById("dropdown-nav").style.display = "none"; } var navmenu = document.getElementById("nav-menu"); var menuheight = navmenu.clientHeight; var kmain = document.getElementById("k-main-id"); kmain.style.minHeight = (menuheight + 100) + 'px'; } window.onresize = resetMobileUI; window.addEventListener("load", (event) => { resetMobileUI() }); </script> <div id='dropdown-nav' onclick="displayDropdownMenu();"> <svg viewBox="-20 -20 120 120" width="60" height="60"> <rect width="100" height="20"></rect> <rect y="30" width="100" height="20"></rect> <rect y="60" width="100" height="20"></rect> </svg> </div> <form class="bd-search d-flex align-items-center k-search-form" id="search-form"> <input type="search" class="k-search-input" id="search-input" placeholder="Search Keras documentation..." aria-label="Search Keras documentation..." autocomplete="off"> <button class="k-search-btn"> <svg width="13" height="13" viewBox="0 0 13 13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg> </button> </form> <script> var form = document.getElementById('search-form'); form.onsubmit = function(e) { e.preventDefault(); var query = document.getElementById('search-input').value; window.location.href = '/search.html?query=' + query; return False } </script> </div> <div class='k-main-inner' id='k-main-id'> <div class='k-location-slug'> <span class="k-location-slug-pointer">►</span> <a href='/api/'>Keras 3 API documentation</a> / <a href='/api/ops/'>Ops API</a> / NumPy ops </div> <div class='k-content'> <h1 id="numpy-ops">NumPy ops</h1> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L86">[source]</a></span></p> <h3 id="absolute-function"><code>absolute</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">absolute</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Compute the absolute value element-wise.</p> <p><code>keras.ops.abs</code> is a shorthand for this function.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>An array containing the absolute value of each element in <code>x</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="o">-</span><span class="mf">1.2</span><span class="p">,</span> <span class="mf">1.2</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">absolute</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">1.2</span><span class="p">,</span> <span class="mf">1.2</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L139">[source]</a></span></p> <h3 id="add-function"><code>add</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Add arguments element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The tensor containing the element-wise sum of <code>x1</code> and <code>x2</code>.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x1</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">])</span> <span class="o">>>></span> <span class="n">x2</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">6</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <p><a href="/api/ops/numpy#add-function"><code>keras.ops.add</code></a> also broadcasts shapes:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x1</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">(</span> <span class="o">...</span> <span class="p">[[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="o">...</span> <span class="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]]</span> <span class="o">...</span> <span class="p">)</span> <span class="o">>>></span> <span class="n">x2</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">10</span> <span class="mi">10</span><span class="p">]</span> <span class="p">[</span><span class="mi">10</span> <span class="mi">12</span><span class="p">]],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L198">[source]</a></span></p> <h3 id="all-function"><code>all</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Test whether all array elements along a given axis evaluate to <code>True</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: An integer or tuple of integers that represent the axis along which a logical AND reduction is performed. The default (<code>axis=None</code>) is to perform a logical AND over all the dimensions of the input array. <code>axis</code> may be negative, in which case it counts for the last to the first axis.</li> <li><strong>keepdims</strong>: If <code>True</code>, axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. Defaults to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>The tensor containing the logical AND reduction over the <code>axis</code>.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="kc">True</span><span class="p">,</span> <span class="kc">False</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="kc">False</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">False</span><span class="p">],</span> <span class="p">[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">True</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="kc">True</span> <span class="kc">False</span><span class="p">],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span> </code></pre></div> <p><code>keepdims=True</code> outputs a tensor with dimensions reduced to one.</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">False</span><span class="p">],</span> <span class="p">[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">True</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="kc">False</span><span class="p">]],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L321">[source]</a></span></p> <h3 id="amax-function"><code>amax</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Returns the maximum of an array or maximum value along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which to compute the maximum. By default (<code>axis=None</code>), find the maximum value in all the dimensions of the input array.</li> <li><strong>keepdims</strong>: If <code>True</code>, axes which are reduced are left in the result as dimensions that are broadcast to the size of the original input tensor. Defaults to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>An array with the maximum value. If <code>axis=None</code>, the result is a scalar value representing the maximum element in the entire array. If <code>axis</code> is given, the result is an array with the maximum values along the specified axis.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amax</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">2</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">2</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">8</span><span class="p">],</span> <span class="p">[</span><span class="mi">5</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L376">[source]</a></span></p> <h3 id="amin-function"><code>amin</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Returns the minimum of an array or minimum value along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which to compute the minimum. By default (<code>axis=None</code>), find the minimum value in all the dimensions of the input array.</li> <li><strong>keepdims</strong>: If <code>True</code>, axes which are reduced are left in the result as dimensions that are broadcast to the size of the original input tensor. Defaults to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>An array with the minimum value. If <code>axis=None</code>, the result is a scalar value representing the minimum element in the entire array. If <code>axis</code> is given, the result is an array with the minimum values along the specified axis.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">amin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">],[</span><span class="mi">3</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L262">[source]</a></span></p> <h3 id="any-function"><code>any</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Test whether any array element along a given axis evaluates to <code>True</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: An integer or tuple of integers that represent the axis along which a logical OR reduction is performed. The default (<code>axis=None</code>) is to perform a logical OR over all the dimensions of the input array. <code>axis</code> may be negative, in which case it counts for the last to the first axis.</li> <li><strong>keepdims</strong>: If <code>True</code>, axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. Defaults to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>The tensor containing the logical OR reduction over the <code>axis</code>.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="kc">True</span><span class="p">,</span> <span class="kc">False</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="kc">True</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">False</span><span class="p">],</span> <span class="p">[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">True</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="kc">True</span> <span class="kc">True</span><span class="p">],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span> </code></pre></div> <p><code>keepdims=True</code> outputs a tensor with dimensions reduced to one.</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">False</span><span class="p">],</span> <span class="p">[</span><span class="kc">True</span><span class="p">,</span> <span class="kc">True</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="kc">False</span><span class="p">]],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L447">[source]</a></span></p> <h3 id="append-function"><code>append</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Append tensor <code>x2</code> to the end of tensor <code>x1</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> <li><strong>axis</strong>: Axis along which tensor <code>x2</code> is appended to tensor <code>x1</code>. If <code>None</code>, both tensors are flattened before use.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor with the values of <code>x2</code> appended to <code>x1</code>.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x1</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="o">>>></span> <span class="n">x2</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <p>When <code>axis</code> is specified, <code>x1</code> and <code>x2</code> must have compatible shapes.</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x1</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">x2</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">x3</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x3</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">):</span> <span class="o">...</span> <span class="ne">TypeError</span><span class="p">:</span> <span class="n">Cannot</span> <span class="n">concatenate</span> <span class="n">arrays</span> <span class="k">with</span> <span class="n">different</span> <span class="n">numbers</span> <span class="n">of</span> <span class="n">dimensions</span><span class="p">:</span> <span class="n">got</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,)</span><span class="o">.</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L508">[source]</a></span></p> <h3 id="arange-function"><code>arange</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return evenly spaced values within a given interval.</p> <p><code>arange</code> can be called with a varying number of positional arguments: * <code>arange(stop)</code>: Values are generated within the half-open interval <code>[0, stop)</code> (in other words, the interval including start but excluding stop). * <code>arange(start, stop)</code>: Values are generated within the half-open interval <code>[start, stop)</code>. * <code>arange(start, stop, step)</code>: Values are generated within the half-open interval <code>[start, stop)</code>, with spacing between values given by step.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>start</strong>: Integer or real, representing the start of the interval. The interval includes this value.</li> <li><strong>stop</strong>: Integer or real, representing the end of the interval. The interval does not include this value, except in some cases where <code>step</code> is not an integer and floating point round-off affects the length of <code>out</code>. Defaults to <code>None</code>.</li> <li><strong>step</strong>: Integer or real, represent the spacing between values. For any output <code>out</code>, this is the distance between two adjacent values, <code>out[i+1] - out[i]</code>. The default step size is 1. If <code>step</code> is specified as a position argument, <code>start</code> must also be given.</li> <li><strong>dtype</strong>: The type of the output array. If <code>dtype</code> is not given, infer the data type from the other input arguments.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of evenly spaced values. For floating point arguments, the length of the result is <code>ceil((stop - start)/step)</code>. Because of floating point overflow, this rule may result in the last element of out being greater than stop.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L570">[source]</a></span></p> <h3 id="arccos-function"><code>arccos</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arccos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Trigonometric inverse cosine, element-wise.</p> <p>The inverse of <code>cos</code> so that, if <code>y = cos(x)</code>, then <code>x = arccos(y)</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of the angle of the ray intersecting the unit circle at the given x-coordinate in radians <code>[0, pi]</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arccos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">3.1415927</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L606">[source]</a></span></p> <h3 id="arccosh-function"><code>arccosh</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arccosh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Inverse hyperbolic cosine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as x.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">10</span><span class="p">,</span> <span class="mi">100</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arccosh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">2.993223</span><span class="p">,</span> <span class="mf">5.298292</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L640">[source]</a></span></p> <h3 id="arcsin-function"><code>arcsin</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arcsin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Inverse sine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of the inverse sine of each element in <code>x</code>, in radians and in the closed interval <code>[-pi/2, pi/2]</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arcsin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mf">1.5707964</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.5707964</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L675">[source]</a></span></p> <h3 id="arcsinh-function"><code>arcsinh</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arcsinh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Inverse hyperbolic sine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arcsinh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.88137364</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.88137364</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L709">[source]</a></span></p> <h3 id="arctan-function"><code>arctan</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Trigonometric inverse tangent, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of the inverse tangent of each element in <code>x</code>, in the interval <code>[-pi/2, pi/2]</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">0.7853982</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L748">[source]</a></span></p> <h3 id="arctan2-function"><code>arctan2</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctan2</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Element-wise arc tangent of <code>x1/x2</code> choosing the quadrant correctly.</p> <p>The quadrant (i.e., branch) is chosen so that <code>arctan2(x1, x2)</code> is the signed angle in radians between the ray ending at the origin and passing through the point <code>(1, 0)</code>, and the ray ending at the origin and passing through the point <code>(x2, x1)</code>. (Note the role reversal: the "y-coordinate" is the first function parameter, the "x-coordinate" is the second.) By IEEE convention, this function is defined for <code>x2 = +/-0</code> and for either or both of <code>x1</code> and <code>x2</code> <code>= +/-inf</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of angles in radians, in the range <code>[-pi, pi]</code>.</p> <p><strong>Examples</strong></p> <p>Consider four points in different quadrants:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">])</span> <span class="o">>>></span> <span class="n">y</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="o">+</span><span class="mi">1</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctan2</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span> <span class="o">*</span> <span class="mi">180</span> <span class="o">/</span> <span class="n">numpy</span><span class="o">.</span><span class="n">pi</span> <span class="n">array</span><span class="p">([</span><span class="o">-</span><span class="mf">135.</span><span class="p">,</span> <span class="o">-</span><span class="mf">45.</span><span class="p">,</span> <span class="mf">45.</span><span class="p">,</span> <span class="mf">135.</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <p>Note the order of the parameters. <code>arctan2</code> is defined also when x2=0 and at several other points, obtaining values in the range <code>[-pi, pi]</code>:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctan2</span><span class="p">(</span> <span class="o">...</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.</span><span class="p">]),</span> <span class="o">...</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]),</span> <span class="o">...</span> <span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mf">1.5707964</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.5707964</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctan2</span><span class="p">(</span> <span class="o">...</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="n">numpy</span><span class="o">.</span><span class="n">inf</span><span class="p">]),</span> <span class="o">...</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="o">+</span><span class="mf">0.</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.</span><span class="p">,</span> <span class="n">numpy</span><span class="o">.</span><span class="n">inf</span><span class="p">]),</span> <span class="o">...</span> <span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">3.1415925</span><span class="p">,</span> <span class="mf">0.7853982</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L806">[source]</a></span></p> <h3 id="arctanh-function"><code>arctanh</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arctanh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Inverse hyperbolic tangent, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L840">[source]</a></span></p> <h3 id="argmax-function"><code>argmax</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Returns the indices of the maximum values along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: By default, the index is into the flattened tensor, otherwise along the specified axis.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one. Defaults to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of indices. It has the same shape as <code>x</code>, with the dimension along <code>axis</code> removed.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="mi">10</span> <span class="o">>>></span> <span class="n">x</span> <span class="n">array</span><span class="p">([[</span><span class="mi">10</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">12</span><span class="p">],</span> <span class="p">[</span><span class="mi">13</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mi">15</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L891">[source]</a></span></p> <h3 id="argmin-function"><code>argmin</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Returns the indices of the minimum values along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: By default, the index is into the flattened tensor, otherwise along the specified axis.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one. Defaults to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of indices. It has the same shape as <code>x</code>, with the dimension along <code>axis</code> removed.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="mi">10</span> <span class="o">>>></span> <span class="n">x</span> <span class="n">array</span><span class="p">([[</span><span class="mi">10</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">12</span><span class="p">],</span> <span class="p">[</span><span class="mi">13</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mi">15</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argmin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6661">[source]</a></span></p> <h3 id="argpartition-function"><code>argpartition</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argpartition</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">kth</span><span class="p">,</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> </code></pre></div> <p>Performs an indirect partition along the given axis.</p> <p>It returns an array of indices of the same shape as <code>x</code> that index data along the given axis in partitioned order.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>a</strong>: Array to sort.</li> <li><strong>kth</strong>: Element index to partition by. The k-th element will be in its final sorted position and all smaller elements will be moved before it and all larger elements behind it. The order of all elements in the partitions is undefined. If provided with a sequence of k-th it will partition all of them into their sorted position at once.</li> <li><strong>axis</strong>: Axis along which to sort. The default is -1 (the last axis). If <code>None</code>, the flattened array is used.</li> </ul> <p><strong>Returns</strong></p> <p>Array of indices that partition <code>x</code> along the specified <code>axis</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L937">[source]</a></span></p> <h3 id="argsort-function"><code>argsort</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> </code></pre></div> <p>Returns the indices that would sort a tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which to sort. Defaults to <code>-1</code> (the last axis). If <code>None</code>, the flattened tensor is used.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of indices that sort <code>x</code> along the specified <code>axis</code>.</p> <p><strong>Examples</strong></p> <p>One dimensional array:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <p>Two-dimensional array:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">x</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L983">[source]</a></span></p> <h3 id="array-function"><code>array</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Create a tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>dtype</strong>: The desired data-type for the tensor.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">"float32"</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1051">[source]</a></span></p> <h3 id="average-function"><code>average</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">average</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">weights</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Compute the weighted average along the specified axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Integer along which to average <code>x</code>. The default, <code>axis=None</code>, will average over all of the elements of the input tensor. If axis is negative it counts from the last to the first axis.</li> <li><strong>weights</strong>: Tensor of weights associated with the values in <code>x</code>. Each value in <code>x</code> contributes to the average according to its associated weight. The weights array can either be 1-D (in which case its length must be the size of a along the given axis) or of the same shape as <code>x</code>. If <code>weights=None</code> (default), then all data in <code>x</code> are assumed to have a weight equal to one.</li> <li>__ The 1-D calculation is__: <code>avg = sum(a * weights) / sum(weights)</code>. The only constraint on weights is that <code>sum(weights)</code> must not be 0.</li> </ul> <p><strong>Returns</strong></p> <p>Return the average along the specified axis.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">data</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> <span class="o">>>></span> <span class="n">data</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">average</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="mf">2.5</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">average</span><span class="p">(</span> <span class="o">...</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">11</span><span class="p">),</span> <span class="o">...</span> <span class="n">weights</span><span class="o">=</span><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">...</span> <span class="p">)</span> <span class="n">array</span><span class="p">(</span><span class="mf">4.</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">data</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> <span class="o">>>></span> <span class="n">data</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">average</span><span class="p">(</span> <span class="o">...</span> <span class="n">data</span><span class="p">,</span> <span class="o">...</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="o">...</span> <span class="n">weights</span><span class="o">=</span><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="mf">3.</span><span class="o">/</span><span class="mi">4</span><span class="p">])</span> <span class="o">...</span> <span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.75</span><span class="p">,</span> <span class="mf">2.75</span><span class="p">,</span> <span class="mf">4.75</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">average</span><span class="p">(</span> <span class="o">...</span> <span class="n">data</span><span class="p">,</span> <span class="o">...</span> <span class="n">weights</span><span class="o">=</span><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="mf">3.</span><span class="o">/</span><span class="mi">4</span><span class="p">])</span> <span class="o">...</span> <span class="p">)</span> <span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">):</span> <span class="o">...</span> <span class="ne">ValueError</span><span class="p">:</span> <span class="n">Axis</span> <span class="n">must</span> <span class="n">be</span> <span class="n">specified</span> <span class="n">when</span> <span class="n">shapes</span> <span class="n">of</span> <span class="n">a</span> <span class="ow">and</span> <span class="n">weights</span> <span class="n">differ</span><span class="o">.</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1140">[source]</a></span></p> <h3 id="bincount-function"><code>bincount</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bincount</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">weights</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">minlength</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">sparse</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Count the number of occurrences of each value in a tensor of integers.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor. It must be of dimension 1, and it must only contain non-negative integer(s).</li> <li><strong>weights</strong>: Weight tensor. It must have the same length as <code>x</code>. The default value is <code>None</code>. If specified, <code>x</code> is weighted by it, i.e. if <code>n = x[i]</code>, <code>out[n] += weight[i]</code> instead of the default behavior <code>out[n] += 1</code>.</li> <li><strong>minlength</strong>: An integer. The default value is 0. If specified, there will be at least this number of bins in the output tensor. If greater than <code>max(x) + 1</code>, each value of the output at an index higher than <code>max(x)</code> is set to 0.</li> <li><strong>sparse</strong>: Whether to return a sparse tensor; for backends that support sparse tensors.</li> </ul> <p><strong>Returns</strong></p> <p>1D tensor where each element gives the number of occurrence(s) of its index value in x. Its length is the maximum between <code>max(x) + 1</code> and minlength.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">"uint8"</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bincount</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> <span class="o">>>></span> <span class="n">weights</span> <span class="o">=</span> <span class="n">x</span> <span class="o">/</span> <span class="mi">2</span> <span class="o">>>></span> <span class="n">weights</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float64</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bincount</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">weights</span><span class="o">=</span><span class="n">weights</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float64</span><span class="p">)</span> <span class="o">>>></span> <span class="n">minlength</span> <span class="o">=</span> <span class="p">(</span><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="mi">2</span> <span class="c1"># 6</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bincount</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">minlength</span><span class="o">=</span><span class="n">minlength</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int32</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1199">[source]</a></span></p> <h3 id="bitwiseand-function"><code>bitwise_and</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_and</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Compute the bit-wise AND of two arrays element-wise.</p> <p>Computes the bit-wise AND of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator <code>&</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1230">[source]</a></span></p> <h3 id="bitwiseinvert-function"><code>bitwise_invert</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_invert</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Compute bit-wise inversion, or bit-wise NOT, element-wise.</p> <p>Computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator <code>~</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1355">[source]</a></span></p> <h3 id="bitwiseleftshift-function"><code>bitwise_left_shift</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_left_shift</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Shift the bits of an integer to the left.</p> <p>Bits are shifted to the left by appending <code>y</code> 0s at the right of <code>x</code>. Since the internal representation of numbers is in binary format, this operation is equivalent to multiplying <code>x</code> by <code>2**y</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1260">[source]</a></span></p> <h3 id="bitwisenot-function"><code>bitwise_not</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_not</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Compute bit-wise inversion, or bit-wise NOT, element-wise.</p> <p>Computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator <code>~</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1291">[source]</a></span></p> <h3 id="bitwiseor-function"><code>bitwise_or</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_or</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Compute the bit-wise OR of two arrays element-wise.</p> <p>Computes the bit-wise OR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator <code>|</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1421">[source]</a></span></p> <h3 id="bitwiserightshift-function"><code>bitwise_right_shift</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_right_shift</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Shift the bits of an integer to the right.</p> <p>Bits are shifted to the right <code>y</code>. Because the internal representation of numbers is in binary format, this operation is equivalent to dividing <code>x</code> by <code>2**y</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1323">[source]</a></span></p> <h3 id="bitwisexor-function"><code>bitwise_xor</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">bitwise_xor</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Compute the bit-wise XOR of two arrays element-wise.</p> <p>Computes the bit-wise XOR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator <code>^</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1489">[source]</a></span></p> <h3 id="broadcastto-function"><code>broadcast_to</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">broadcast_to</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">shape</span><span class="p">)</span> </code></pre></div> <p>Broadcast a tensor to a new shape.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: The tensor to broadcast.</li> <li><strong>shape</strong>: The shape of the desired tensor. A single integer <code>i</code> is interpreted as <code>(i,)</code>.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor with the desired shape.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">broadcast_to</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> <span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1531">[source]</a></span></p> <h3 id="ceil-function"><code>ceil</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">ceil</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the ceiling of the input, element-wise.</p> <p>The ceil of the scalar <code>x</code> is the smallest integer <code>i</code>, such that <code>i >= x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The ceiling of each element in <code>x</code>, with float dtype.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1565">[source]</a></span></p> <h3 id="clip-function"><code>clip</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">clip</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">x_min</span><span class="p">,</span> <span class="n">x_max</span><span class="p">)</span> </code></pre></div> <p>Clip (limit) the values in a tensor.</p> <p>Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of <code>[0, 1]</code> is specified, values smaller than 0 become 0, and values larger than 1 become 1.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>x_min</strong>: Minimum value.</li> <li><strong>x_max</strong>: Maximum value.</li> </ul> <p><strong>Returns</strong></p> <p>The clipped tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1622">[source]</a></span></p> <h3 id="concatenate-function"><code>concatenate</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">concatenate</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Join a sequence of tensors along an existing axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>xs</strong>: The sequence of tensors to concatenate.</li> <li><strong>axis</strong>: The axis along which the tensors will be joined. Defaults to <code>0</code>.</li> </ul> <p><strong>Returns</strong></p> <p>The concatenated tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1676">[source]</a></span></p> <h3 id="conj-function"><code>conj</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">conj</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Shorthand for <a href="/api/ops/numpy#conjugate-function"><code>keras.ops.conjugate</code></a>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1652">[source]</a></span></p> <h3 id="conjugate-function"><code>conjugate</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">conjugate</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Returns the complex conjugate, element-wise.</p> <p>The complex conjugate of a complex number is obtained by changing the sign of its imaginary part.</p> <p><a href="/api/ops/numpy#conj-function"><code>keras.ops.conj</code></a> is a shorthand for this function.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The complex conjugate of each element in <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1691">[source]</a></span></p> <h3 id="copy-function"><code>copy</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Returns a copy of <code>x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>A copy of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6525">[source]</a></span></p> <h3 id="correlate-function"><code>correlate</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">correlate</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">"valid"</span><span class="p">)</span> </code></pre></div> <p>Compute the cross-correlation of two 1-dimensional tensors.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First 1-dimensional input tensor of length M.</li> <li><strong>x2</strong>: Second 1-dimensional input tensor of length N.</li> <li><strong>mode</strong>: Either <code>valid</code>, <code>same</code> or <code>full</code>. By default the mode is set to <code>valid</code>, which returns an output of length max(M, N) - min(M, N) + 1. <code>same</code> returns an output of length max(M, N). <code>full</code> mode returns the convolution at each point of overlap, with an output length of N+M-1</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, cross-correlation of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1719">[source]</a></span></p> <h3 id="cos-function"><code>cos</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Cosine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The corresponding cosine values.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1747">[source]</a></span></p> <h3 id="cosh-function"><code>cosh</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">cosh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Hyperbolic cosine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1780">[source]</a></span></p> <h3 id="countnonzero-function"><code>count_nonzero</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">count_nonzero</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Counts the number of non-zero values in <code>x</code> along the given <code>axis</code>.</p> <p>If no axis is specified then all non-zeros in the tensor are counted.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or tuple of axes along which to count the number of non-zeros. Defaults to <code>None</code>.</li> </ul> <p><strong>Returns</strong></p> <p>int or tensor of ints.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">19</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">count_nonzero</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="mi">5</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">count_nonzero</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int64</span><span class="p">)</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">count_nonzero</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">int64</span><span class="p">)</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1862">[source]</a></span></p> <h3 id="cross-function"><code>cross</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">cross</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">axisa</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">axisb</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">axisc</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Returns the cross product of two (arrays of) vectors.</p> <p>The cross product of <code>x1</code> and <code>x2</code> in R^3 is a vector perpendicular to both <code>x1</code> and <code>x2</code>. If <code>x1</code> and <code>x2</code> are arrays of vectors, the vectors are defined by the last axis of <code>x1</code> and <code>x2</code> by default, and these axes can have dimensions 2 or 3.</p> <p>Where the dimension of either <code>x1</code> or <code>x2</code> is 2, the third component of the input vector is assumed to be zero and the cross product calculated accordingly.</p> <p>In cases where both input vectors have dimension 2, the z-component of the cross product is returned.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: Components of the first vector(s).</li> <li><strong>x2</strong>: Components of the second vector(s).</li> <li><strong>axisa</strong>: Axis of <code>x1</code> that defines the vector(s). Defaults to <code>-1</code>.</li> <li><strong>axisb</strong>: Axis of <code>x2</code> that defines the vector(s). Defaults to <code>-1</code>.</li> <li><strong>axisc</strong>: Axis of the result containing the cross product vector(s). Ignored if both input vectors have dimension 2, as the return is scalar. By default, the last axis.</li> <li><strong>axis</strong>: If defined, the axis of <code>x1</code>, <code>x2</code> and the result that defines the vector(s) and cross product(s). Overrides <code>axisa</code>, <code>axisb</code> and <code>axisc</code>.</li> </ul> <p>Note: Torch backend does not support two dimensional vectors, or the arguments <code>axisa</code>, <code>axisb</code> and <code>axisc</code>. Use <code>axis</code> instead.</p> <p><strong>Returns</strong></p> <p>Vector cross product(s).</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1934">[source]</a></span></p> <h3 id="cumprod-function"><code>cumprod</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">cumprod</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return the cumulative product of elements along a given axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which the cumulative product is computed. By default the input is flattened.</li> <li><strong>dtype</strong>: dtype of returned tensor. Defaults to x.dtype.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1973">[source]</a></span></p> <h3 id="cumsum-function"><code>cumsum</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">cumsum</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Returns the cumulative sum of elements along a given axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which the cumulative sum is computed. By default the input is flattened.</li> <li><strong>dtype</strong>: dtype of returned tensor. Defaults to x.dtype.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2026">[source]</a></span></p> <h3 id="diag-function"><code>diag</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Extract a diagonal or construct a diagonal array.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor. If <code>x</code> is 2-D, returns the k-th diagonal of <code>x</code>. If <code>x</code> is 1-D, return a 2-D tensor with <code>x</code> on the k-th diagonal.</li> <li><strong>k</strong>: The diagonal to consider. Defaults to <code>0</code>. Use <code>k > 0</code> for diagonals above the main diagonal, and <code>k < 0</code> for diagonals below the main diagonal.</li> </ul> <p><strong>Returns</strong></p> <p>The extracted diagonal or constructed diagonal tensor.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="kn">from</span> <span class="nn">keras.src</span> <span class="kn">import</span> <span class="n">ops</span> <span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">9</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> <span class="o">>>></span> <span class="n">x</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">]])</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">8</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">])</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">x</span><span class="p">)))</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">8</span><span class="p">]])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2107">[source]</a></span></p> <h3 id="diagonal-function"><code>diagonal</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">diagonal</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">axis1</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">axis2</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> </code></pre></div> <p>Return specified diagonals.</p> <p>If <code>x</code> is 2-D, returns the diagonal of <code>x</code> with the given offset, i.e., the collection of elements of the form <code>x[i, i+offset]</code>.</p> <p>If <code>x</code> has more than two dimensions, the axes specified by <code>axis1</code> and <code>axis2</code> are used to determine the 2-D sub-array whose diagonal is returned.</p> <p>The shape of the resulting array can be determined by removing <code>axis1</code> and <code>axis2</code> and appending an index to the right equal to the size of the resulting diagonals.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>offset</strong>: Offset of the diagonal from the main diagonal. Can be positive or negative. Defaults to <code>0</code>.(main diagonal).</li> <li><strong>axis1</strong>: Axis to be used as the first axis of the 2-D sub-arrays. Defaults to <code>0</code>.(first axis).</li> <li><strong>axis2</strong>: Axis to be used as the second axis of the 2-D sub-arrays. Defaults to <code>1</code> (second axis).</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of diagonals.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="kn">from</span> <span class="nn">keras.src</span> <span class="kn">import</span> <span class="n">ops</span> <span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> <span class="o">>>></span> <span class="n">x</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">x</span><span class="o">.</span><span class="n">diagonal</span><span class="p">()</span> <span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="o">>>></span> <span class="n">x</span><span class="o">.</span><span class="n">diagonal</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">])</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> <span class="o">>>></span> <span class="n">x</span> <span class="n">array</span><span class="p">([[[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]],</span> <span class="p">[[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">]]])</span> <span class="o">>>></span> <span class="n">x</span><span class="o">.</span><span class="n">diagonal</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">7</span><span class="p">]])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2186">[source]</a></span></p> <h3 id="diff-function"><code>diff</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> </code></pre></div> <p>Calculate the n-th discrete difference along the given axis.</p> <p>The first difference is given by <code>out[i] = a[i+1] - a[i]</code> along the given axis, higher differences are calculated by using <code>diff</code> recursively.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>a</strong>: Input tensor.</li> <li><strong>n</strong>: The number of times values are differenced. Defaults to <code>1</code>.</li> <li><strong>axis</strong>: Axis to compute discrete difference(s) along. Defaults to <code>-1</code>.(last axis).</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of diagonals.</p> <p><strong>Examples</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="kn">from</span> <span class="nn">keras.src</span> <span class="kn">import</span> <span class="n">ops</span> <span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">7</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">10</span><span class="p">])</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">convert_to_tensor</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">]])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2236">[source]</a></span></p> <h3 id="digitize-function"><code>digitize</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">digitize</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">bins</span><span class="p">)</span> </code></pre></div> <p>Returns the indices of the bins to which each value in <code>x</code> belongs.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input array to be binned.</li> <li><strong>bins</strong>: Array of bins. It has to be one-dimensional and monotonically increasing.</li> </ul> <p><strong>Returns</strong></p> <p>Output array of indices, of same shape as <code>x</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">3.0</span><span class="p">,</span> <span class="mf">1.6</span><span class="p">])</span> <span class="o">>>></span> <span class="n">bins</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">3.0</span><span class="p">,</span> <span class="mf">4.5</span><span class="p">,</span> <span class="mf">7.0</span><span class="p">])</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">digitize</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">bins</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5933">[source]</a></span></p> <h3 id="divide-function"><code>divide</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">divide</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Divide arguments element-wise.</p> <p><a href="/api/ops/numpy#truedivide-function"><code>keras.ops.true_divide</code></a> is an alias for this function.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, the quotient <code>x1/x2</code>, element-wise.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5972">[source]</a></span></p> <h3 id="dividenonan-function"><code>divide_no_nan</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">divide_no_nan</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Safe element-wise division which returns 0 where the denominator is 0.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The quotient <code>x1/x2</code>, element-wise, with zero where x2 is zero.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2299">[source]</a></span></p> <h3 id="dot-function"><code>dot</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Dot product of two tensors.</p> <ul> <li>If both <code>x1</code> and <code>x2</code> are 1-D tensors, it is inner product of vectors (without complex conjugation).</li> <li>If both <code>x1</code> and <code>x2</code> are 2-D tensors, it is matrix multiplication.</li> <li>If either <code>x1</code> or <code>x2</code> is 0-D (scalar), it is equivalent to <code>x1 * x2</code>.</li> <li>If <code>x1</code> is an N-D tensor and <code>x2</code> is a 1-D tensor, it is a sum product over the last axis of <code>x1</code> and <code>x2</code>.</li> <li>If <code>x1</code> is an N-D tensor and <code>x2</code> is an M-D tensor (where <code>M>=2</code>), it is a sum product over the last axis of <code>x1</code> and the second-to-last axis of <code>x2</code>: <code>dot(x1, x2)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])</code>.</li> </ul> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First argument.</li> <li><strong>x2</strong>: Second argument.</li> </ul> <p>Note: Torch backend does not accept 0-D tensors as arguments.</p> <p><strong>Returns</strong></p> <p>Dot product of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2507">[source]</a></span></p> <h3 id="einsum-function"><code>einsum</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">subscripts</span><span class="p">,</span> <span class="o">*</span><span class="n">operands</span><span class="p">)</span> </code></pre></div> <p>Evaluates the Einstein summation convention on the operands.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>subscripts</strong>: Specifies the subscripts for summation as comma separated list of subscript labels. An implicit (classical Einstein summation) calculation is performed unless the explicit indicator <code>-></code> is included as well as subscript labels of the precise output form.</li> <li><strong>operands</strong>: The operands to compute the Einstein sum of.</li> </ul> <p><strong>Returns</strong></p> <p>The calculation based on the Einstein summation convention.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="kn">from</span> <span class="nn">keras.src</span> <span class="kn">import</span> <span class="n">ops</span> <span class="o">>>></span> <span class="n">a</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> <span class="o">>>></span> <span class="n">b</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="o">>>></span> <span class="n">c</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> </code></pre></div> <p>Trace of a matrix:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"ii"</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span> <span class="mi">60</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span> <span class="mi">60</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">trace</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="mi">60</span> </code></pre></div> <p>Extract the diagonal:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"ii -> i"</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">18</span><span class="p">,</span> <span class="mi">24</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="n">array</span><span class="p">([</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">18</span><span class="p">,</span> <span class="mi">24</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">diag</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">18</span><span class="p">,</span> <span class="mi">24</span><span class="p">])</span> </code></pre></div> <p>Sum over an axis:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"ij -> i"</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">85</span><span class="p">,</span> <span class="mi">110</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="n">array</span><span class="p">([</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">85</span><span class="p">,</span> <span class="mi">110</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">85</span><span class="p">,</span> <span class="mi">110</span><span class="p">])</span> </code></pre></div> <p>For higher dimensional tensors summing a single axis can be done with ellipsis:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"...j -> ..."</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">85</span><span class="p">,</span> <span class="mi">110</span><span class="p">])</span> <span class="o">>>></span> <span class="n">np</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="o">...</span><span class="p">])</span> <span class="n">array</span><span class="p">([</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">85</span><span class="p">,</span> <span class="mi">110</span><span class="p">])</span> </code></pre></div> <p>Compute a matrix transpose or reorder any number of axes:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"ji"</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"ij -> ji"</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">c</span><span class="p">)</span> <span class="n">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">]])</span> </code></pre></div> <p>Matrix vector multiplication:</p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"ij, j"</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">130</span><span class="p">,</span> <span class="mi">180</span><span class="p">,</span> <span class="mi">230</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">b</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="n">array</span><span class="p">([</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">130</span><span class="p">,</span> <span class="mi">180</span><span class="p">,</span> <span class="mi">230</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">einsum</span><span class="p">(</span><span class="s2">"...j, j"</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">130</span><span class="p">,</span> <span class="mi">180</span><span class="p">,</span> <span class="mi">230</span><span class="p">])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2605">[source]</a></span></p> <h3 id="empty-function"><code>empty</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">empty</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a tensor of given shape and type filled with uninitialized data.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>shape</strong>: Shape of the empty tensor.</li> <li><strong>dtype</strong>: Desired data type of the empty tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The empty tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2630">[source]</a></span></p> <h3 id="equal-function"><code>equal</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">equal</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Returns <code>(x1 == x2)</code> element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: Tensor to compare.</li> <li><strong>x2</strong>: Tensor to compare.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise comparison of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2657">[source]</a></span></p> <h3 id="exp-function"><code>exp</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Calculate the exponential of all elements in the input tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise exponential of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2719">[source]</a></span></p> <h3 id="expanddims-function"><code>expand_dims</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">expand_dims</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="p">)</span> </code></pre></div> <p>Expand the shape of a tensor.</p> <p>Insert a new axis at the <code>axis</code> position in the expanded tensor shape.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Position in the expanded axes where the new axis (or axes) is placed.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor with the number of dimensions increased.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2755">[source]</a></span></p> <h3 id="expm1-function"><code>expm1</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">expm1</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Calculate <code>exp(x) - 1</code> for all elements in the tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input values.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise exponential minus one.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6404">[source]</a></span></p> <h3 id="eye-function"><code>eye</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">eye</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a 2-D tensor with ones on the diagonal and zeros elsewhere.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>N</strong>: Number of rows in the output.</li> <li><strong>M</strong>: Number of columns in the output. If <code>None</code>, defaults to <code>N</code>.</li> <li><strong>k</strong>: Index of the diagonal: 0 (the default) refers to the main diagonal, a positive value refers to an upper diagonal, and a negative value to a lower diagonal.</li> <li><strong>dtype</strong>: Data type of the returned tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor with ones on the k-th diagonal and zeros elsewhere.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2782">[source]</a></span></p> <h3 id="flip-function"><code>flip</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">flip</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Reverse the order of elements in the tensor along the given axis.</p> <p>The shape of the tensor is preserved, but the elements are reordered.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which to flip the tensor. The default, <code>axis=None</code>, will flip over all of the axes of the input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor with entries of <code>axis</code> reversed.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2815">[source]</a></span></p> <h3 id="floor-function"><code>floor</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">floor</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the floor of the input, element-wise.</p> <p>The floor of the scalar <code>x</code> is the largest integer <code>i</code>, such that <code>i <= x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise floor of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6437">[source]</a></span></p> <h3 id="floordivide-function"><code>floor_divide</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">floor_divide</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Returns the largest integer smaller or equal to the division of inputs.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: Numerator.</li> <li><strong>x2</strong>: Denominator.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, <code>y = floor(x1/x2)</code></p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2841">[source]</a></span></p> <h3 id="full-function"><code>full</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="n">fill_value</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a new tensor of given shape and type, filled with <code>fill_value</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>shape</strong>: Shape of the new tensor.</li> <li><strong>fill_value</strong>: Fill value.</li> <li><strong>dtype</strong>: Desired data type of the tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2865">[source]</a></span></p> <h3 id="fulllike-function"><code>full_like</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">full_like</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">fill_value</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a full tensor with the same shape and type as the given tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>fill_value</strong>: Fill value.</li> <li><strong>dtype</strong>: Overrides data type of the result.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of <code>fill_value</code> with the same shape and type as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2955">[source]</a></span></p> <h3 id="getitem-function"><code>get_item</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">get_item</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> </code></pre></div> <p>Return <code>x[key]</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L2974">[source]</a></span></p> <h3 id="greater-function"><code>greater</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">greater</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Return the truth value of <code>x1 > x2</code> element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise comparison of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3001">[source]</a></span></p> <h3 id="greaterequal-function"><code>greater_equal</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">greater_equal</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Return the truth value of <code>x1 >= x2</code> element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise comparison of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6722">[source]</a></span></p> <h3 id="histogram-function"><code>histogram</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">histogram</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="nb">range</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Computes a histogram of the data tensor <code>x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>bins</strong>: An integer representing the number of histogram bins. Defaults to 10.</li> <li><strong>range</strong>: A tuple representing the lower and upper range of the bins. If not specified, it will use the min and max of <code>x</code>.</li> </ul> <p><strong>Returns</strong></p> <ul> <li><strong>A tuple containing</strong>:</li> <li>A tensor representing the counts of elements in each bin.</li> <li>A tensor representing the bin edges.</li> </ul> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code>```python >>> input_tensor = np.random.rand(8) >>> keras.ops.histogram(input_tensor) (array([1, 1, 1, 0, 0, 1, 2, 1, 0, 1], dtype=int32), array([0.0189519 , 0.10294958, 0.18694726, 0.27094494, 0.35494262, 0.43894029, 0.52293797, 0.60693565, 0.69093333, 0.77493101, 0.85892869])) </code></pre></div> <div class="codehilite"><pre><span></span><code>---- <span style="float:right;">[[source]](https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3049)</span> ### `hstack` function ```python keras.ops.hstack(xs) </code></pre></div> <p>Stack tensors in sequence horizontally (column wise).</p> <p>This is equivalent to concatenation along the first axis for 1-D tensors, and along the second axis for all other tensors.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>xs</strong>: Sequence of tensors.</li> </ul> <p><strong>Returns</strong></p> <p>The tensor formed by stacking the given tensors.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3076">[source]</a></span></p> <h3 id="identity-function"><code>identity</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">identity</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return the identity tensor.</p> <p>The identity tensor is a square tensor with ones on the main diagonal and zeros elsewhere.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>n</strong>: Number of rows (and columns) in the <code>n x n</code> output tensor.</li> <li><strong>dtype</strong>: Data type of the output tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The identity tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3102">[source]</a></span></p> <h3 id="imag-function"><code>imag</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">imag</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the imaginary part of the complex argument.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The imaginary component of the complex argument.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3130">[source]</a></span></p> <h3 id="isclose-function"><code>isclose</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">isclose</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">rtol</span><span class="o">=</span><span class="mf">1e-05</span><span class="p">,</span> <span class="n">atol</span><span class="o">=</span><span class="mf">1e-08</span><span class="p">,</span> <span class="n">equal_nan</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Return whether two tensors are element-wise almost equal.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> <li><strong>rtol</strong>: Relative tolerance.</li> <li><strong>atol</strong>: Absolute tolerance.</li> <li><strong>equal_nan</strong>: If <code>True</code>, element-wise NaNs are considered equal.</li> </ul> <p><strong>Returns</strong></p> <p>Output boolean tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3157">[source]</a></span></p> <h3 id="isfinite-function"><code>isfinite</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return whether a tensor is finite, element-wise.</p> <p>Real values are finite when they are not NaN, not positive infinity, and not negative infinity. Complex values are finite when both their real and imaginary parts are finite.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output boolean tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3184">[source]</a></span></p> <h3 id="isinf-function"><code>isinf</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">isinf</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Test element-wise for positive or negative infinity.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output boolean tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3207">[source]</a></span></p> <h3 id="isnan-function"><code>isnan</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Test element-wise for NaN and return result as a boolean tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output boolean tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1389">[source]</a></span></p> <h3 id="leftshift-function"><code>left_shift</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">left_shift</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Shift the bits of an integer to the left.</p> <p>Bits are shifted to the left by appending <code>y</code> 0s at the right of <code>x</code>. Since the internal representation of numbers is in binary format, this operation is equivalent to multiplying <code>x</code> by <code>2**y</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3233">[source]</a></span></p> <h3 id="less-function"><code>less</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">less</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Return the truth value of <code>x1 < x2</code> element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise comparison of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3260">[source]</a></span></p> <h3 id="lessequal-function"><code>less_equal</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">less_equal</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Return the truth value of <code>x1 <= x2</code> element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise comparison of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3333">[source]</a></span></p> <h3 id="linspace-function"><code>linspace</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span> <span class="n">start</span><span class="p">,</span> <span class="n">stop</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">retstep</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span> <span class="p">)</span> </code></pre></div> <p>Return evenly spaced numbers over a specified interval.</p> <p>Returns <code>num</code> evenly spaced samples, calculated over the interval <code>[start, stop]</code>.</p> <p>The endpoint of the interval can optionally be excluded.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>start</strong>: The starting value of the sequence.</li> <li><strong>stop</strong>: The end value of the sequence, unless <code>endpoint</code> is set to <code>False</code>. In that case, the sequence consists of all but the last of <code>num + 1</code> evenly spaced samples, so that <code>stop</code> is excluded. Note that the step size changes when <code>endpoint</code> is <code>False</code>.</li> <li><strong>num</strong>: Number of samples to generate. Defaults to <code>50</code>. Must be non-negative.</li> <li><strong>endpoint</strong>: If <code>True</code>, <code>stop</code> is the last sample. Otherwise, it is not included. Defaults to <code>True</code>.</li> <li><strong>retstep</strong>: If <code>True</code>, return <code>(samples, step)</code>, where <code>step</code> is the spacing between samples.</li> <li><strong>dtype</strong>: The type of the output tensor.</li> <li><strong>axis</strong>: The axis in the result to store the samples. Relevant only if start or stop are array-like. Defaults to <code>0</code>.</li> </ul> <p>Note: Torch backend does not support <code>axis</code> argument.</p> <p><strong>Returns</strong></p> <p>A tensor of evenly spaced numbers. If <code>retstep</code> is <code>True</code>, returns <code>(samples, step)</code></p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3393">[source]</a></span></p> <h3 id="log-function"><code>log</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Natural logarithm, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise natural logarithm of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3421">[source]</a></span></p> <h3 id="log10-function"><code>log10</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the base 10 logarithm of the input tensor, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise base 10 logarithm of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3450">[source]</a></span></p> <h3 id="log1p-function"><code>log1p</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">log1p</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Returns the natural logarithm of one plus the <code>x</code>, element-wise.</p> <p>Calculates <code>log(1 + x)</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise natural logarithm of <code>1 + x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3480">[source]</a></span></p> <h3 id="log2-function"><code>log2</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">log2</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Base-2 logarithm of <code>x</code>, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise base-2 logarithm of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3511">[source]</a></span></p> <h3 id="logaddexp-function"><code>logaddexp</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">logaddexp</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Logarithm of the sum of exponentiations of the inputs.</p> <p>Calculates <code>log(exp(x1) + exp(x2))</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: Input tensor.</li> <li><strong>x2</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise logarithm of the sum of exponentiations of the inputs.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3541">[source]</a></span></p> <h3 id="logicaland-function"><code>logical_and</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">logical_and</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Computes the element-wise logical AND of the given input tensors.</p> <p>Zeros are treated as <code>False</code> and non-zeros are treated as <code>True</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: Input tensor.</li> <li><strong>x2</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise logical AND of the inputs.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3572">[source]</a></span></p> <h3 id="logicalnot-function"><code>logical_not</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">logical_not</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Computes the element-wise NOT of the given input tensor.</p> <p>Zeros are treated as <code>False</code> and non-zeros are treated as <code>True</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise logical NOT of the input.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3605">[source]</a></span></p> <h3 id="logicalor-function"><code>logical_or</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">logical_or</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Computes the element-wise logical OR of the given input tensors.</p> <p>Zeros are treated as <code>False</code> and non-zeros are treated as <code>True</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: Input tensor.</li> <li><strong>x2</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise logical OR of the inputs.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6464">[source]</a></span></p> <h3 id="logicalxor-function"><code>logical_xor</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">logical_xor</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Compute the truth value of <code>x1 XOR x2</code>, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output boolean tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3675">[source]</a></span></p> <h3 id="logspace-function"><code>logspace</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">logspace</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">stop</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Returns numbers spaced evenly on a log scale.</p> <p>In linear space, the sequence starts at <code>base ** start</code> and ends with <code>base ** stop</code> (see <code>endpoint</code> below).</p> <p><strong>Arguments</strong></p> <ul> <li><strong>start</strong>: The starting value of the sequence.</li> <li><strong>stop</strong>: The final value of the sequence, unless <code>endpoint</code> is <code>False</code>. In that case, <code>num + 1</code> values are spaced over the interval in log-space, of which all but the last (a sequence of length <code>num</code>) are returned.</li> <li><strong>num</strong>: Number of samples to generate. Defaults to <code>50</code>.</li> <li><strong>endpoint</strong>: If <code>True</code>, <code>stop</code> is the last sample. Otherwise, it is not included. Defaults to <code>True</code>.</li> <li><strong>base</strong>: The base of the log space. Defaults to <code>10</code>.</li> <li><strong>dtype</strong>: The type of the output tensor.</li> <li><strong>axis</strong>: The axis in the result to store the samples. Relevant only if start or stop are array-like.</li> </ul> <p>Note: Torch backend does not support <code>axis</code> argument.</p> <p><strong>Returns</strong></p> <p>A tensor of evenly spaced samples on a log scale.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3737">[source]</a></span></p> <h3 id="matmul-function"><code>matmul</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Matrix product of two tensors.</p> <ul> <li>If both tensors are 1-dimensional, the dot product (scalar) is returned.</li> <li>If either tensor is N-D, N > 2, it is treated as a stack of matrices residing in the last two indexes and broadcast accordingly.</li> <li>If the first tensor is 1-D, it is promoted to a matrix by prepending a 1 to its dimensions. After matrix multiplication the prepended 1 is removed.</li> <li>If the second tensor is 1-D, it is promoted to a matrix by appending a 1 to its dimensions. After matrix multiplication the appended 1 is removed.</li> </ul> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First tensor.</li> <li><strong>x2</strong>: Second tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, matrix product of the inputs.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3784">[source]</a></span></p> <h3 id="max-function"><code>max</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">initial</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return the maximum of a tensor or maximum along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which to operate. By default, flattened input is used.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one. Defaults to <code>False</code>.</li> <li><strong>initial</strong>: The minimum value of an output element. Defaults to <code>None</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Maximum of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3826">[source]</a></span></p> <h3 id="maximum-function"><code>maximum</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Element-wise maximum of <code>x1</code> and <code>x2</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First tensor.</li> <li><strong>x2</strong>: Second tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise maximum of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6238">[source]</a></span></p> <h3 id="mean-function"><code>mean</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Compute the arithmetic mean along the specified axes.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which the means are computed. The default is to compute the mean of the flattened tensor.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor containing the mean values.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3864">[source]</a></span></p> <h3 id="median-function"><code>median</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">median</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Compute the median along the specified axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which the medians are computed. Defaults to <code>axis=None</code> which is to compute the median(s) along a flattened version of the array.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduce are left in the result as dimensions with size one.</li> </ul> <p><strong>Returns</strong></p> <p>The output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3918">[source]</a></span></p> <h3 id="meshgrid-function"><code>meshgrid</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">(</span><span class="o">*</span><span class="n">x</span><span class="p">,</span> <span class="n">indexing</span><span class="o">=</span><span class="s2">"xy"</span><span class="p">)</span> </code></pre></div> <p>Creates grids of coordinates from coordinate vectors.</p> <p>Given <code>N</code> 1-D tensors <code>T0, T1, ..., TN-1</code> as inputs with corresponding lengths <code>S0, S1, ..., SN-1</code>, this creates an <code>N</code> N-dimensional tensors <code>G0, G1, ..., GN-1</code> each with shape <code>(S0, ..., SN-1)</code> where the output <code>Gi</code> is constructed by expanding <code>Ti</code> to the result shape.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: 1-D tensors representing the coordinates of a grid.</li> <li><strong>indexing</strong>: <code>"xy"</code> or <code>"ij"</code>. "xy" is cartesian; <code>"ij"</code> is matrix indexing of output. Defaults to <code>"xy"</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Sequence of N tensors.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="kn">from</span> <span class="nn">keras.src</span> <span class="kn">import</span> <span class="n">ops</span> <span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="o">>>></span> <span class="n">y</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">])</span> </code></pre></div> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">grid_x</span><span class="p">,</span> <span class="n">grid_y</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">indexing</span><span class="o">=</span><span class="s2">"ij"</span><span class="p">)</span> <span class="o">>>></span> <span class="n">grid_x</span> <span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">]])</span> <span class="o">>>></span> <span class="n">grid_y</span> <span class="n">array</span><span class="p">([[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L3977">[source]</a></span></p> <h3 id="min-function"><code>min</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">initial</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return the minimum of a tensor or minimum along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which to operate. By default, flattened input is used.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one. Defaults to <code>False</code>.</li> <li><strong>initial</strong>: The maximum value of an output element. Defaults to <code>None</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Minimum of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4019">[source]</a></span></p> <h3 id="minimum-function"><code>minimum</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">minimum</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Element-wise minimum of <code>x1</code> and <code>x2</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First tensor.</li> <li><strong>x2</strong>: Second tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise minimum of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4052">[source]</a></span></p> <h3 id="mod-function"><code>mod</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">mod</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Returns the element-wise remainder of division.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First tensor.</li> <li><strong>x2</strong>: Second tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise remainder of division.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4112">[source]</a></span></p> <h3 id="moveaxis-function"><code>moveaxis</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">moveaxis</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="n">destination</span><span class="p">)</span> </code></pre></div> <p>Move axes of a tensor to new positions.</p> <p>Other axes remain in their original order.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Tensor whose axes should be reordered.</li> <li><strong>source</strong>: Original positions of the axes to move. These must be unique.</li> <li><strong>destination</strong>: Destinations positions for each of the original axes. These must also be unique.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor with moved axes.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5896">[source]</a></span></p> <h3 id="multiply-function"><code>multiply</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">multiply</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Multiply arguments element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise product of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4148">[source]</a></span></p> <h3 id="nantonum-function"><code>nan_to_num</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">nan_to_num</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">nan</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">posinf</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">neginf</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Replace NaN with zero and infinity with large finite numbers.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input data.</li> <li><strong>nan</strong>: Optional float or int. Value to replace <code>NaN</code> entries with.</li> <li><strong>posinf</strong>: Optional float or int. Value to replace positive infinity with.</li> <li><strong>neginf</strong>: Optional float or int. Value to replace negative infinity with.</li> </ul> <p><strong>Returns</strong></p> <p><code>x</code>, with non-finite values replaced.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4183">[source]</a></span></p> <h3 id="ndim-function"><code>ndim</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">ndim</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the number of dimensions of a tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The number of dimensions in <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6061">[source]</a></span></p> <h3 id="negative-function"><code>negative</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">negative</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Numerical negative, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, <code>y = -x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4208">[source]</a></span></p> <h3 id="nonzero-function"><code>nonzero</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">nonzero</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the indices of the elements that are non-zero.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Indices of elements that are non-zero.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/linalg.py#L307">[source]</a></span></p> <h3 id="norm-function"><code>norm</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="nb">ord</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Matrix or vector norm.</p> <p>This function is able to return one of eight different matrix norms, or one of an infinite number of vector norms (described below), depending on the value of the <code>ord</code> parameter.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>ord</strong>: Order of the norm (see table under Notes). The default is <code>None</code>.</li> <li><strong>axis</strong>: If <code>axis</code> is an integer, it specifies the axis of <code>x</code> along which to compute the vector norms. If <code>axis</code> is a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of these matrices are computed.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one.</li> </ul> <p>Note: For values of <code>ord < 1</code>, the result is, strictly speaking, not a mathematical 'norm', but it may still be useful for various numerical purposes. The following norms can be calculated: - For matrices: - <code>ord=None</code>: Frobenius norm - <code>ord="fro"</code>: Frobenius norm - <code>ord="nuc"</code>: nuclear norm - <code>ord=np.inf</code>: <code>max(sum(abs(x), axis=1))</code> - <code>ord=-np.inf</code>: <code>min(sum(abs(x), axis=1))</code> - <code>ord=0</code>: not supported - <code>ord=1</code>: <code>max(sum(abs(x), axis=0))</code> - <code>ord=-1</code>: <code>min(sum(abs(x), axis=0))</code> - <code>ord=2</code>: 2-norm (largest sing. value) - <code>ord=-2</code>: smallest singular value - other: not supported - For vectors: - <code>ord=None</code>: 2-norm - <code>ord="fro"</code>: not supported - <code>ord="nuc"</code>: not supported - <code>ord=np.inf</code>: <code>max(abs(x))</code> - <code>ord=-np.inf</code>: <code>min(abs(x))</code> - <code>ord=0</code>: <code>sum(x != 0)</code> - <code>ord=1</code>: as below - <code>ord=-1</code>: as below - <code>ord=2</code>: as below - <code>ord=-2</code>: as below - other: <code>sum(abs(x)**ord)**(1./ord)</code></p> <p><strong>Returns</strong></p> <p>Norm of the matrix or vector(s).</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">9</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">"float32"</span><span class="p">)</span> <span class="o">-</span> <span class="mi">4</span><span class="p">,</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> <span class="o">>>></span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="mf">7.7459664</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4234">[source]</a></span></p> <h3 id="notequal-function"><code>not_equal</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">not_equal</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Return <code>(x1 != x2)</code> element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise comparison of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6375">[source]</a></span></p> <h3 id="ones-function"><code>ones</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a new tensor of given shape and type, filled with ones.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>shape</strong>: Shape of the new tensor.</li> <li><strong>dtype</strong>: Desired data type of the tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of ones with the given shape and dtype.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4260">[source]</a></span></p> <h3 id="oneslike-function"><code>ones_like</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">ones_like</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a tensor of ones with the same shape and type of <code>x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>dtype</strong>: Overrides the data type of the result.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor of ones with the same shape and type as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4330">[source]</a></span></p> <h3 id="outer-function"><code>outer</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">outer</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Compute the outer product of two vectors.</p> <p>Given two vectors <code>x1</code> and <code>x2</code>, the outer product is:</p> <div class="codehilite"><pre><span></span><code>out[i, j] = x1[i] * x2[j] </code></pre></div> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Outer product of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4413">[source]</a></span></p> <h3 id="pad-function"><code>pad</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">pad</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">pad_width</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">"constant"</span><span class="p">,</span> <span class="n">constant_values</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Pad a tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Tensor to pad.</li> <li><strong>pad_width</strong>: Number of values padded to the edges of each axis. <code>((before_1, after_1), ...(before_N, after_N))</code> unique pad widths for each axis. <code>((before, after),)</code> yields same before and after pad for each axis. <code>(pad,)</code> or <code>int</code> is a shortcut for <code>before = after = pad</code> width for all axes.</li> <li><strong>mode</strong>: One of <code>"constant"</code>, <code>"edge"</code>, <code>"linear_ramp"</code>, <code>"maximum"</code>, <code>"mean"</code>, <code>"median"</code>, <code>"minimum"</code>, <code>"reflect"</code>, <code>"symmetric"</code>, <code>"wrap"</code>, <code>"empty"</code>, <code>"circular"</code>. Defaults to <code>"constant"</code>.</li> <li><strong>constant_values</strong>: value to pad with if <code>mode == "constant"</code>. Defaults to <code>0</code>. A <code>ValueError</code> is raised if not None and <code>mode != "constant"</code>.</li> </ul> <p>Note: Torch backend only supports modes <code>"constant"</code>, <code>"reflect"</code>, <code>"symmetric"</code> and <code>"circular"</code>. Only Torch backend supports <code>"circular"</code> mode.</p> <p>Note: Tensorflow backend only supports modes <code>"constant"</code>, <code>"reflect"</code> and <code>"symmetric"</code>.</p> <p><strong>Returns</strong></p> <p>Padded tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6036">[source]</a></span></p> <h3 id="power-function"><code>power</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">power</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>First tensor elements raised to powers from second tensor, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: The bases.</li> <li><strong>x2</strong>: The exponents.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, the bases in <code>x1</code> raised to the exponents in <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4487">[source]</a></span></p> <h3 id="prod-function"><code>prod</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">prod</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return the product of tensor elements over a given axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which a product is performed. The default, <code>axis=None</code>, will compute the product of all elements in the input tensor.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduce are left in the result as dimensions with size one.</li> <li><strong>dtype</strong>: Data type of the returned tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Product of elements of <code>x</code> over the given axis or axes.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4536">[source]</a></span></p> <h3 id="quantile-function"><code>quantile</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">quantile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s2">"linear"</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Compute the q-th quantile(s) of the data along the specified axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>q</strong>: Probability or sequence of probabilities for the quantiles to compute. Values must be between 0 and 1 inclusive.</li> <li><strong>axis</strong>: Axis or axes along which the quantiles are computed. Defaults to <code>axis=None</code> which is to compute the quantile(s) along a flattened version of the array.</li> <li><strong>method</strong>: A string specifies the method to use for estimating the quantile. Available methods are <code>"linear"</code>, <code>"lower"</code>, <code>"higher"</code>, <code>"midpoint"</code>, and <code>"nearest"</code>. Defaults to <code>"linear"</code>. If the desired quantile lies between two data points <code>i < j</code>:<ul> <li><code>"linear"</code>: <code>i + (j - i) * fraction</code>, where fraction is the fractional part of the index surrounded by <code>i</code> and <code>j</code>.</li> <li><code>"lower"</code>: <code>i</code>.</li> <li><code>"higher"</code>: <code>j</code>.</li> <li><code>"midpoint"</code>: <code>(i + j) / 2</code></li> <li><code>"nearest"</code>: <code>i</code> or <code>j</code>, whichever is nearest.</li> </ul> </li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduce are left in the result as dimensions with size one.</li> </ul> <p><strong>Returns</strong></p> <p>The quantile(s). If <code>q</code> is a single probability and <code>axis=None</code>, then the result is a scalar. If multiple probabilities levels are given, first axis of the result corresponds to the quantiles. The other axes are the axes that remain after the reduction of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4589">[source]</a></span></p> <h3 id="ravel-function"><code>ravel</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">ravel</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return a contiguous flattened tensor.</p> <p>A 1-D tensor, containing the elements of the input, is returned.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4615">[source]</a></span></p> <h3 id="real-function"><code>real</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">real</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the real part of the complex argument.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The real component of the complex argument.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4638">[source]</a></span></p> <h3 id="reciprocal-function"><code>reciprocal</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">reciprocal</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the reciprocal of the argument, element-wise.</p> <p>Calculates <code>1/x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise reciprocal of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4712">[source]</a></span></p> <h3 id="repeat-function"><code>repeat</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">repeat</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">repeats</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Repeat each element of a tensor after themselves.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>repeats</strong>: The number of repetitions for each element.</li> <li><strong>axis</strong>: The axis along which to repeat values. By default, use the flattened input array, and return a flat output array.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4746">[source]</a></span></p> <h3 id="reshape-function"><code>reshape</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">newshape</span><span class="p">)</span> </code></pre></div> <p>Gives a new shape to a tensor without changing its data.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>newshape</strong>: The new shape should be compatible with the original shape. One shape dimension can be -1 in which case the value is inferred from the length of the array and remaining dimensions.</li> </ul> <p><strong>Returns</strong></p> <p>The reshaped tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L1455">[source]</a></span></p> <h3 id="rightshift-function"><code>right_shift</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">right_shift</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> </code></pre></div> <p>Shift the bits of an integer to the right.</p> <p>Bits are shifted to the right <code>y</code>. Because the internal representation of numbers is in binary format, this operation is equivalent to dividing <code>x</code> by <code>2**y</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input integer tensor.</li> <li><strong>y</strong>: Input integer tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Result tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4777">[source]</a></span></p> <h3 id="roll-function"><code>roll</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">roll</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">shift</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Roll tensor elements along a given axis.</p> <p>Elements that roll beyond the last position are re-introduced at the first.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>shift</strong>: The number of places by which elements are shifted.</li> <li><strong>axis</strong>: The axis along which elements are shifted. By default, the array is flattened before shifting, after which the original shape is restored.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4811">[source]</a></span></p> <h3 id="round-function"><code>round</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">round</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">decimals</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Evenly round to the given number of decimals.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>decimals</strong>: Number of decimal places to round to. Defaults to <code>0</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4847">[source]</a></span></p> <h3 id="searchsorted-function"><code>searchsorted</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">searchsorted</span><span class="p">(</span><span class="n">sorted_sequence</span><span class="p">,</span> <span class="n">values</span><span class="p">,</span> <span class="n">side</span><span class="o">=</span><span class="s2">"left"</span><span class="p">)</span> </code></pre></div> <p>Perform a binary search, returning indices for insertion of <code>values</code> into <code>sorted_sequence</code> that maintain the sorting order.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>sorted_sequence</strong>: 1-D input tensor, sorted along the innermost dimension.</li> <li><strong>values</strong>: N-D tensor of query insertion values.</li> <li><strong>side</strong>: 'left' or 'right', specifying the direction in which to insert for the equality case (tie-breaker).</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of insertion indices of same shape as <code>values</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6559">[source]</a></span></p> <h3 id="select-function"><code>select</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">condlist</span><span class="p">,</span> <span class="n">choicelist</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Return elements from <code>choicelist</code>, based on conditions in <code>condlist</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>condlist</strong>: List of boolean tensors. The list of conditions which determine from which array in choicelist the output elements are taken. When multiple conditions are satisfied, the first one encountered in condlist is used.</li> <li><strong>choicelist</strong>: List of tensors. The list of tensors from which the output elements are taken. This list has to be of the same length as <code>condlist</code>.</li> <li><strong>defaults</strong>: Optional scalar value. The element inserted in the output when all conditions evaluate to <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor where the output at position <code>m</code> is the <code>m</code>-th element of the tensor in <code>choicelist</code> where the <code>m</code>-th element of the corresponding tensor in <code>condlist</code> is <code>True</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="kn">from</span> <span class="nn">keras</span> <span class="kn">import</span> <span class="n">ops</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span> <span class="n">condlist</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o"><</span><span class="mi">3</span><span class="p">,</span> <span class="n">x</span><span class="o">></span><span class="mi">3</span><span class="p">]</span> <span class="n">choicelist</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">]</span> <span class="n">ops</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">condlist</span><span class="p">,</span> <span class="n">choicelist</span><span class="p">,</span> <span class="mi">42</span><span class="p">)</span> <span class="c1"># # Returns tensor([0, 1, 2, 42, 16, 25])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4879">[source]</a></span></p> <h3 id="sign-function"><code>sign</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">sign</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Returns a tensor with the signs of the elements of <code>x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4908">[source]</a></span></p> <h3 id="sin-function"><code>sin</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Trigonometric sine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4937">[source]</a></span></p> <h3 id="sinh-function"><code>sinh</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">sinh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Hyperbolic sine, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4960">[source]</a></span></p> <h3 id="size-function"><code>size</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the number of elements in a tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Number of elements in <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6627">[source]</a></span></p> <h3 id="slogdet-function"><code>slogdet</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">slogdet</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Compute the sign and natural logarithm of the determinant of a matrix.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input matrix. It must 2D and square.</li> </ul> <p><strong>Returns</strong></p> <p>A tuple <code>(sign, logabsdet)</code>. <code>sign</code> is a number representing the sign of the determinant. For a real matrix, this is 1, 0, or -1. For a complex matrix, this is a complex number with absolute value 1 (i.e., it is on the unit circle), or else 0. <code>logabsdet</code> is the natural log of the absolute value of the determinant.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4987">[source]</a></span></p> <h3 id="sort-function"><code>sort</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> </code></pre></div> <p>Sorts the elements of <code>x</code> along a given axis in ascending order.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which to sort. If <code>None</code>, the tensor is flattened before sorting. Defaults to <code>-1</code>; the last axis.</li> </ul> <p><strong>Returns</strong></p> <p>Sorted tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5049">[source]</a></span></p> <h3 id="split-function"><code>split</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">indices_or_sections</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Split a tensor into chunks.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>indices_or_sections</strong>: If an integer, N, the tensor will be split into N equal sections along <code>axis</code>. If a 1-D array of sorted integers, the entries indicate indices at which the tensor will be split along <code>axis</code>.</li> <li><strong>axis</strong>: Axis along which to split. Defaults to <code>0</code>.</li> </ul> <p>Note: A split does not have to result in equal division when using Torch backend.</p> <p><strong>Returns</strong></p> <p>A list of tensors.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6118">[source]</a></span></p> <h3 id="sqrt-function"><code>sqrt</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the non-negative square root of a tensor, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, the non-negative square root of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6088">[source]</a></span></p> <h3 id="square-function"><code>square</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">square</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the element-wise square of the input.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, the square of <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6162">[source]</a></span></p> <h3 id="squeeze-function"><code>squeeze</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">squeeze</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Remove axes of length one from <code>x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Select a subset of the entries of length one in the shape.</li> </ul> <p><strong>Returns</strong></p> <p>The input tensor with all or a subset of the dimensions of length 1 removed.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5105">[source]</a></span></p> <h3 id="stack-function"><code>stack</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">stack</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Join a sequence of tensors along a new axis.</p> <p>The <code>axis</code> parameter specifies the index of the new axis in the dimensions of the result.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: A sequence of tensors.</li> <li><strong>axis</strong>: Axis along which to stack. Defaults to <code>0</code>.</li> </ul> <p><strong>Returns</strong></p> <p>The stacked tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5146">[source]</a></span></p> <h3 id="std-function"><code>std</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">std</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Compute the standard deviation along the specified axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis along which to compute standard deviation. Default is to compute the standard deviation of the flattened tensor.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor containing the standard deviation values.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5862">[source]</a></span></p> <h3 id="subtract-function"><code>subtract</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">subtract</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Subtract arguments element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor, element-wise difference of <code>x1</code> and <code>x2</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6324">[source]</a></span></p> <h3 id="sum-function"><code>sum</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Sum of a tensor over the given axes.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which the sum is computed. The default is to compute the sum of the flattened tensor.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor containing the sum.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5184">[source]</a></span></p> <h3 id="swapaxes-function"><code>swapaxes</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">swapaxes</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis1</span><span class="p">,</span> <span class="n">axis2</span><span class="p">)</span> </code></pre></div> <p>Interchange two axes of a tensor.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis1</strong>: First axis.</li> <li><strong>axis2</strong>: Second axis.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor with the axes swapped.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5224">[source]</a></span></p> <h3 id="take-function"><code>take</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">take</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">indices</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Take elements from a tensor along an axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Source tensor.</li> <li><strong>indices</strong>: The indices of the values to extract.</li> <li><strong>axis</strong>: The axis over which to select values. By default, the flattened input tensor is used.</li> </ul> <p><strong>Returns</strong></p> <p>The corresponding tensor of values.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5257">[source]</a></span></p> <h3 id="takealongaxis-function"><code>take_along_axis</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">take_along_axis</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">indices</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Select values from <code>x</code> at the 1-D <code>indices</code> along the given axis.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Source tensor.</li> <li><strong>indices</strong>: The indices of the values to extract.</li> <li><strong>axis</strong>: The axis over which to select values. By default, the flattened input tensor is used.</li> </ul> <p><strong>Returns</strong></p> <p>The corresponding tensor of values.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5294">[source]</a></span></p> <h3 id="tan-function"><code>tan</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">tan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Compute tangent, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5323">[source]</a></span></p> <h3 id="tanh-function"><code>tanh</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">tanh</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Hyperbolic tangent, element-wise.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor of same shape as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5383">[source]</a></span></p> <h3 id="tensordot-function"><code>tensordot</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">tensordot</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">axes</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> </code></pre></div> <p>Compute the tensor dot product along specified axes.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First tensor.</li> <li><strong>x2</strong>: Second tensor.</li> <li><strong>axes</strong>: - If an integer, N, sum over the last N axes of <code>x1</code> and the first N axes of <code>x2</code> in order. The sizes of the corresponding axes must match. - Or, a list of axes to be summed over, first sequence applying to <code>x1</code>, second to <code>x2</code>. Both sequences must be of the same length.</li> </ul> <p><strong>Returns</strong></p> <p>The tensor dot product of the inputs.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5432">[source]</a></span></p> <h3 id="tile-function"><code>tile</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">tile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">repeats</span><span class="p">)</span> </code></pre></div> <p>Repeat <code>x</code> the number of times given by <code>repeats</code>.</p> <p>If <code>repeats</code> has length <code>d</code>, the result will have dimension of <code>max(d, x.ndim)</code>.</p> <p>If <code>x.ndim < d</code>, <code>x</code> is promoted to be d-dimensional by prepending new axes.</p> <p>If <code>x.ndim > d</code>, <code>repeats</code> is promoted to <code>x.ndim</code> by prepending 1's to it.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>repeats</strong>: The number of repetitions of <code>x</code> along each axis.</li> </ul> <p><strong>Returns</strong></p> <p>The tiled output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5481">[source]</a></span></p> <h3 id="trace-function"><code>trace</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">trace</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">axis1</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">axis2</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> </code></pre></div> <p>Return the sum along diagonals of the tensor.</p> <p>If <code>x</code> is 2-D, the sum along its diagonal with the given offset is returned, i.e., the sum of elements <code>x[i, i+offset]</code> for all <code>i</code>.</p> <p>If a has more than two dimensions, then the axes specified by <code>axis1</code> and <code>axis2</code> are used to determine the 2-D sub-arrays whose traces are returned.</p> <p>The shape of the resulting tensor is the same as that of <code>x</code> with <code>axis1</code> and <code>axis2</code> removed.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>offset</strong>: Offset of the diagonal from the main diagonal. Can be both positive and negative. Defaults to <code>0</code>.</li> <li><strong>axis1</strong>: Axis to be used as the first axis of the 2-D sub-arrays. Defaults to <code>0</code>.(first axis).</li> <li><strong>axis2</strong>: Axis to be used as the second axis of the 2-D sub-arrays. Defaults to <code>1</code> (second axis).</li> </ul> <p><strong>Returns</strong></p> <p>If <code>x</code> is 2-D, the sum of the diagonal is returned. If <code>x</code> has larger dimensions, then a tensor of sums along diagonals is returned.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6195">[source]</a></span></p> <h3 id="transpose-function"><code>transpose</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axes</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Returns a tensor with <code>axes</code> transposed.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axes</strong>: Sequence of integers. Permutation of the dimensions of <code>x</code>. By default, the order of the axes are reversed.</li> </ul> <p><strong>Returns</strong></p> <p><code>x</code> with its axes permuted.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5529">[source]</a></span></p> <h3 id="tri-function"><code>tri</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">tri</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a tensor with ones at and below a diagonal and zeros elsewhere.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>N</strong>: Number of rows in the tensor.</li> <li><strong>M</strong>: Number of columns in the tensor.</li> <li><strong>k</strong>: The sub-diagonal at and below which the array is filled. <code>k = 0</code> is the main diagonal, while <code>k < 0</code> is below it, and <code>k > 0</code> is above. The default is 0.</li> <li><strong>dtype</strong>: Data type of the returned tensor. The default is "float32".</li> </ul> <p><strong>Returns</strong></p> <p>Tensor with its lower triangle filled with ones and zeros elsewhere. <code>T[i, j] == 1</code> for <code>j <= i + k</code>, 0 otherwise.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5560">[source]</a></span></p> <h3 id="tril-function"><code>tril</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">tril</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Return lower triangle of a tensor.</p> <p>For tensors with <code>ndim</code> exceeding 2, <code>tril</code> will apply to the final two axes.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>k</strong>: Diagonal above which to zero elements. Defaults to <code>0</code>. the main diagonal. <code>k < 0</code> is below it, and <code>k > 0</code> is above it.</li> </ul> <p><strong>Returns</strong></p> <p>Lower triangle of <code>x</code>, of same shape and data type as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5592">[source]</a></span></p> <h3 id="triu-function"><code>triu</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">triu</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </code></pre></div> <p>Return upper triangle of a tensor.</p> <p>For tensors with <code>ndim</code> exceeding 2, <code>triu</code> will apply to the final two axes.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>k</strong>: Diagonal below which to zero elements. Defaults to <code>0</code>. the main diagonal. <code>k < 0</code> is below it, and <code>k > 0</code> is above it.</li> </ul> <p><strong>Returns</strong></p> <p>Upper triangle of <code>x</code>, of same shape and data type as <code>x</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6009">[source]</a></span></p> <h3 id="truedivide-function"><code>true_divide</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">true_divide</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Alias for <a href="/api/ops/numpy#divide-function"><code>keras.ops.divide</code></a>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5623">[source]</a></span></p> <h3 id="trunc-function"><code>trunc</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">trunc</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> </code></pre></div> <p>Return the truncated value of the input, element-wise.</p> <p>The truncated value of the scalar <code>x</code> is the nearest integer <code>i</code> which is closer to zero than <code>x</code> is. In short, the fractional part of the signed number <code>x</code> is discarded.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>The truncated value of each element in <code>x</code>.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="o">>>></span> <span class="n">x</span> <span class="o">=</span> <span class="n">ops</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="o">-</span><span class="mf">1.7</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.5</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.2</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">1.7</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">])</span> <span class="o">>>></span> <span class="n">ops</span><span class="o">.</span><span class="n">trunc</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="n">array</span><span class="p">([</span><span class="o">-</span><span class="mf">1.0</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.0</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">])</span> </code></pre></div> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6276">[source]</a></span></p> <h3 id="var-function"><code>var</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </code></pre></div> <p>Compute the variance along the specified axes.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>axis</strong>: Axis or axes along which the variance is computed. The default is to compute the variance of the flattened tensor.</li> <li><strong>keepdims</strong>: If this is set to <code>True</code>, the axes which are reduced are left in the result as dimensions with size one.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor containing the variance.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5659">[source]</a></span></p> <h3 id="vdot-function"><code>vdot</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">vdot</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">)</span> </code></pre></div> <p>Return the dot product of two vectors.</p> <p>If the first argument is complex, the complex conjugate of the first argument is used for the calculation of the dot product.</p> <p>Multidimensional tensors are flattened before the dot product is taken.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x1</strong>: First input tensor. If complex, its complex conjugate is taken before calculation of the dot product.</li> <li><strong>x2</strong>: Second input tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Output tensor.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5720">[source]</a></span></p> <h3 id="vectorize-function"><code>vectorize</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">vectorize</span><span class="p">(</span><span class="n">pyfunc</span><span class="p">,</span> <span class="n">excluded</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">signature</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Turn a function into a vectorized function.</p> <p><strong>Example</strong></p> <div class="codehilite"><pre><span></span><code><span class="k">def</span> <span class="nf">myfunc</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> <span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span> <span class="n">vfunc</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">vectorize</span><span class="p">(</span><span class="n">myfunc</span><span class="p">)</span> <span class="n">y</span> <span class="o">=</span> <span class="n">vfunc</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="mi">2</span><span class="p">)</span> <span class="c1"># Returns Tensor([3, 4, 5, 6])</span> </code></pre></div> <p><strong>Arguments</strong></p> <ul> <li><strong>pyfunc</strong>: Callable of a single tensor argument.</li> <li><strong>excluded</strong>: Optional set of integers representing positional arguments for which the function will not be vectorized. These will be passed directly to <code>pyfunc</code> unmodified.</li> <li><strong>signature</strong>: Optional generalized universal function signature, e.g., <code>"(m,n),(n)->(m)"</code> for vectorized matrix-vector multiplication. If provided, <code>pyfunc</code> will be called with (and expected to return) arrays with shapes given by the size of corresponding core dimensions. By default, <code>pyfunc</code> is assumed to take scalars tensors as input and output.</li> </ul> <p><strong>Returns</strong></p> <p>A new function that applies <code>pyfunc</code> to every element of its input along axis 0 (the batch axis).</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5789">[source]</a></span></p> <h3 id="vstack-function"><code>vstack</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">vstack</span><span class="p">(</span><span class="n">xs</span><span class="p">)</span> </code></pre></div> <p>Stack tensors in sequence vertically (row wise).</p> <p><strong>Arguments</strong></p> <ul> <li><strong>xs</strong>: Sequence of tensors.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor formed by stacking the given tensors.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L5821">[source]</a></span></p> <h3 id="where-function"><code>where</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">x1</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">x2</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return elements chosen from <code>x1</code> or <code>x2</code> depending on <code>condition</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>condition</strong>: Where <code>True</code>, yield <code>x1</code>, otherwise yield <code>x2</code>.</li> <li><strong>x1</strong>: Values from which to choose when <code>condition</code> is <code>True</code>.</li> <li><strong>x2</strong>: Values from which to choose when <code>condition</code> is <code>False</code>.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor with elements from <code>x1</code> where <code>condition</code> is <code>True</code>, and elements from <code>x2</code> where <code>condition</code> is <code>False</code>.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L6352">[source]</a></span></p> <h3 id="zeros-function"><code>zeros</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a new tensor of given shape and type, filled with zeros.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>shape</strong>: Shape of the new tensor.</li> <li><strong>dtype</strong>: Desired data type of the tensor.</li> </ul> <p><strong>Returns</strong></p> <p>Tensor of zeros with the given shape and dtype.</p> <hr /> <p><span style="float:right;"><a href="https://github.com/keras-team/keras/tree/v3.7.0/keras/src/ops/numpy.py#L4286">[source]</a></span></p> <h3 id="zeroslike-function"><code>zeros_like</code> function</h3> <div class="codehilite"><pre><span></span><code><span class="n">keras</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">zeros_like</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> </code></pre></div> <p>Return a tensor of zeros with the same shape and type as <code>x</code>.</p> <p><strong>Arguments</strong></p> <ul> <li><strong>x</strong>: Input tensor.</li> <li><strong>dtype</strong>: Overrides the data type of the result.</li> </ul> <p><strong>Returns</strong></p> <p>A tensor of zeros with the same shape and type as <code>x</code>.</p> <hr /> </div> <div class='k-outline'> <div class='k-outline-depth-1'> <a href='#numpy-ops'>NumPy ops</a> </div> <div class='k-outline-depth-3'> <a href='#absolute-function'><code>absolute</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#add-function'><code>add</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#all-function'><code>all</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#amax-function'><code>amax</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#amin-function'><code>amin</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#any-function'><code>any</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#append-function'><code>append</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arange-function'><code>arange</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arccos-function'><code>arccos</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arccosh-function'><code>arccosh</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arcsin-function'><code>arcsin</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arcsinh-function'><code>arcsinh</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arctan-function'><code>arctan</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arctan2-function'><code>arctan2</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#arctanh-function'><code>arctanh</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#argmax-function'><code>argmax</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#argmin-function'><code>argmin</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#argpartition-function'><code>argpartition</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#argsort-function'><code>argsort</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#array-function'><code>array</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#average-function'><code>average</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bincount-function'><code>bincount</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwiseand-function'><code>bitwise_and</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwiseinvert-function'><code>bitwise_invert</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwiseleftshift-function'><code>bitwise_left_shift</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwisenot-function'><code>bitwise_not</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwiseor-function'><code>bitwise_or</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwiserightshift-function'><code>bitwise_right_shift</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#bitwisexor-function'><code>bitwise_xor</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#broadcastto-function'><code>broadcast_to</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#ceil-function'><code>ceil</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#clip-function'><code>clip</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#concatenate-function'><code>concatenate</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#conj-function'><code>conj</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#conjugate-function'><code>conjugate</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#copy-function'><code>copy</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#correlate-function'><code>correlate</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#cos-function'><code>cos</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#cosh-function'><code>cosh</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#countnonzero-function'><code>count_nonzero</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#cross-function'><code>cross</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#cumprod-function'><code>cumprod</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#cumsum-function'><code>cumsum</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#diag-function'><code>diag</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#diagonal-function'><code>diagonal</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#diff-function'><code>diff</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#digitize-function'><code>digitize</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#divide-function'><code>divide</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#dividenonan-function'><code>divide_no_nan</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#dot-function'><code>dot</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#einsum-function'><code>einsum</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#empty-function'><code>empty</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#equal-function'><code>equal</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#exp-function'><code>exp</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#expanddims-function'><code>expand_dims</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#expm1-function'><code>expm1</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#eye-function'><code>eye</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#flip-function'><code>flip</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#floor-function'><code>floor</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#floordivide-function'><code>floor_divide</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#full-function'><code>full</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#fulllike-function'><code>full_like</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#getitem-function'><code>get_item</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#greater-function'><code>greater</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#greaterequal-function'><code>greater_equal</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#histogram-function'><code>histogram</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#hstack-function'><code>hstack</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#identity-function'><code>identity</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#imag-function'><code>imag</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#isclose-function'><code>isclose</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#isfinite-function'><code>isfinite</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#isinf-function'><code>isinf</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#isnan-function'><code>isnan</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#leftshift-function'><code>left_shift</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#less-function'><code>less</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#lessequal-function'><code>less_equal</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#linspace-function'><code>linspace</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#log-function'><code>log</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#log10-function'><code>log10</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#log1p-function'><code>log1p</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#log2-function'><code>log2</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#logaddexp-function'><code>logaddexp</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#logicaland-function'><code>logical_and</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#logicalnot-function'><code>logical_not</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#logicalor-function'><code>logical_or</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#logicalxor-function'><code>logical_xor</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#logspace-function'><code>logspace</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#matmul-function'><code>matmul</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#max-function'><code>max</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#maximum-function'><code>maximum</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#mean-function'><code>mean</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#median-function'><code>median</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#meshgrid-function'><code>meshgrid</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#min-function'><code>min</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#minimum-function'><code>minimum</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#mod-function'><code>mod</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#moveaxis-function'><code>moveaxis</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#multiply-function'><code>multiply</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#nantonum-function'><code>nan_to_num</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#ndim-function'><code>ndim</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#negative-function'><code>negative</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#nonzero-function'><code>nonzero</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#norm-function'><code>norm</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#notequal-function'><code>not_equal</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#ones-function'><code>ones</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#oneslike-function'><code>ones_like</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#outer-function'><code>outer</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#pad-function'><code>pad</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#power-function'><code>power</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#prod-function'><code>prod</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#quantile-function'><code>quantile</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#ravel-function'><code>ravel</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#real-function'><code>real</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#reciprocal-function'><code>reciprocal</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#repeat-function'><code>repeat</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#reshape-function'><code>reshape</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#rightshift-function'><code>right_shift</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#roll-function'><code>roll</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#round-function'><code>round</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#searchsorted-function'><code>searchsorted</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#select-function'><code>select</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#sign-function'><code>sign</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#sin-function'><code>sin</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#sinh-function'><code>sinh</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#size-function'><code>size</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#slogdet-function'><code>slogdet</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#sort-function'><code>sort</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#split-function'><code>split</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#sqrt-function'><code>sqrt</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#square-function'><code>square</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#squeeze-function'><code>squeeze</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#stack-function'><code>stack</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#std-function'><code>std</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#subtract-function'><code>subtract</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#sum-function'><code>sum</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#swapaxes-function'><code>swapaxes</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#take-function'><code>take</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#takealongaxis-function'><code>take_along_axis</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#tan-function'><code>tan</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#tanh-function'><code>tanh</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#tensordot-function'><code>tensordot</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#tile-function'><code>tile</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#trace-function'><code>trace</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#transpose-function'><code>transpose</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#tri-function'><code>tri</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#tril-function'><code>tril</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#triu-function'><code>triu</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#truedivide-function'><code>true_divide</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#trunc-function'><code>trunc</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#var-function'><code>var</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#vdot-function'><code>vdot</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#vectorize-function'><code>vectorize</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#vstack-function'><code>vstack</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#where-function'><code>where</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#zeros-function'><code>zeros</code> function</a> </div> <div class='k-outline-depth-3'> <a href='#zeroslike-function'><code>zeros_like</code> function</a> </div> </div> </div> </div> </div> </body> <footer style="float: left; width: 100%; padding: 1em; border-top: solid 1px #bbb;"> <a href="https://policies.google.com/terms">Terms</a> | <a href="https://policies.google.com/privacy">Privacy</a> </footer> </html>