<h1>triton.where<aclass="headerlink"href="#triton-where"title="Permalink to this headline">¶</a></h1>
<dlclass="py function">
<dtid="triton.where">
<codeclass="sig-prename descclassname"><spanclass="pre">triton.</span></code><codeclass="sig-name descname"><spanclass="pre">where</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">condition</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">x</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">y</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">builder</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#triton.where"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a block of elements from either <cite>x</cite> or <cite>y</cite>, depending on <cite>condition</cite>.
Note that <cite>x</cite> and <cite>y</cite> are always evaluated regardless of the value of <cite>condition</cite>.
If you want to avoid unintented memory operations, use the <cite>mask</cite> arguments in <cite>triton.load</cite> and <cite>triton.store</cite> instead.
The shape of <cite>x</cite> and <cite>y</cite> are both broadcast to the shape of <cite>condition</cite>.
<cite>x</cite> and <cite>y</cite> must have the data type.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>condition</strong> (<em>Block of triton.bool</em>) – When True (nonzero), yield x, otherwise yield y.</p></li>
<li><p><strong>x</strong>– values selected at indices where condition is True.</p></li>
<li><p><strong>y</strong>– values selected at indices where condition is False.</p></li>
<li><p><strong>builder</strong> (<em>triton.ir.builder</em>) – IR builder to generate code into, optional from within @triton.jit functions</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<hr/>
<divrole="contentinfo">
<p>
© Copyright 2020, Philippe Tillet.
</p>
</div>
Built with <ahref="https://www.sphinx-doc.org/">Sphinx</a> using a