CINXE.COM
Tensor Operator Set Architecture (TOSA) Dialect - MLIR
<!doctype html><html lang=en-us><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>Tensor Operator Set Architecture (TOSA) Dialect - MLIR</title><meta name=description content="Multi-Level IR Compiler Framework"><meta name=generator content="Hugo 0.119.0"><link href=https://mlir.llvm.org/index.xml rel=alternate type=application/rss+xml><link rel=canonical href=https://mlir.llvm.org/docs/Dialects/TOSA/><link rel=stylesheet href=https://mlir.llvm.org/css/theme.css><script src=https://use.fontawesome.com/releases/v5.0.6/js/all.js></script> <link rel=stylesheet href=https://mlir.llvm.org/css/chroma.min.css><script src=https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js></script> <script src=https://cdn.jsdelivr.net/npm/jquery.easing@1.4.1/jquery.easing.min.js></script> <script src=https://mlir.llvm.org/js/bundle.js></script> <script type=text/javascript src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type=text/x-mathjax-config> MathJax.Hub.Config({ tex2jax: { inlineMath: [['$', '$'] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ] } }); </script><link rel=apple-touch-icon sizes=180x180 href="/apple-touch-icon.png?v=1"><link rel=icon type=image/png sizes=32x32 href="/favicon-32x32.png?v=1"><link rel=icon type=image/png sizes=16x16 href="/favicon-16x16.png?v=1"><link rel=manifest href="/site.webmanifest?v=1"><link rel=mask-icon href="/safari-pinned-tab.svg?v=1" color=#3775e0><link rel="shortcut icon" href="/favicon.ico?v=1"><meta name=msapplication-TileColor content="#2d89ef"><meta name=theme-color content="#ffffff"><link rel=icon href=/favicon.svg type=image/svg+xml sizes=any><style>:root{}</style></head><body><div class=container><header><h1><div><img src=https://mlir.llvm.org//mlir-logo.png width=40px align=absmiddle> MLIR</div></h1><p class=description>Multi-Level IR Compiler Framework</p></header><div class=global-menu><nav><ul><li class=parent><a href>Community<i class="fas fa-angle-right"></i></a><ul class=sub-menu><li class=child><a href=https://llvm.discourse.group/c/mlir/31>Forums</a></li><li class=child><a href=https://discord.gg/xS7Z362>Chat</a></li></ul></li><li><a href=/getting_started/Debugging/>Debugging Tips</a></li><li><a href=/getting_started/Faq/>FAQ</a></li><li class=parent><a href=https://github.com/llvm/llvm-project/tree/main/mlir>Source<i class="fas fa-angle-right"></i></a><ul class=sub-menu><li class=child><a href=/doxygen/>Doxygen</a></li><li class=child><a href=https://github.com/llvm/llvm-project/tree/main/mlir>GitHub</a></li></ul></li><li><a href="https://bugs.llvm.org/buglist.cgi?bug_status=__open__&list_id=177877&order=changeddate%20DESC%2Cpriority%2Cbug_severity&product=MLIR&query_format=specific">Bugs</a></li><li><a href=https://github.com/llvm/mlir-www/tree/main/website/static/LogoAssets>Logo Assets</a></li><li><a href=https://www.youtube.com/MLIRCompiler>Youtube Channel</a></li></ul></nav></div><div class=content-container><main><h1>Tensor Operator Set Architecture (TOSA) Dialect</h1><p><nav id=TableOfContents><ul><li><a href=#rationale>Rationale</a></li><li><a href=#tosa-and-tensor-level-expressiveness>TOSA and Tensor Level Expressiveness</a><ul><li><a href=#complete>Complete</a></li><li><a href=#minimal>Minimal</a></li><li><a href=#numerical-precision>Numerical Precision</a></li></ul></li><li><a href=#tosa-operator-rationale>TOSA Operator Rationale</a><ul><li><a href=#cond_if-and-while_loop>COND_IF and WHILE_LOOP</a></li></ul></li><li><a href=#using-tosa-in-a-compiler>Using TOSA In A Compiler</a><ul><li><a href=#quantization-parameters-in-ops-vs-tensors>Quantization Parameters in Ops vs Tensors</a></li></ul></li><li><a href=#operation-definitions>Operation definitions</a><ul><li><a href=#tosaabs-mlirtosaabsop><code>tosa.abs</code> (mlir::tosa::AbsOp)</a></li><li><a href=#tosaadd-mlirtosaaddop><code>tosa.add</code> (mlir::tosa::AddOp)</a></li><li><a href=#tosaapply_scale-mlirtosaapplyscaleop><code>tosa.apply_scale</code> (mlir::tosa::ApplyScaleOp)</a></li><li><a href=#tosaargmax-mlirtosaargmaxop><code>tosa.argmax</code> (mlir::tosa::ArgMaxOp)</a></li><li><a href=#tosaarithmetic_right_shift-mlirtosaarithmeticrightshiftop><code>tosa.arithmetic_right_shift</code> (mlir::tosa::ArithmeticRightShiftOp)</a></li><li><a href=#tosaavg_pool2d-mlirtosaavgpool2dop><code>tosa.avg_pool2d</code> (mlir::tosa::AvgPool2dOp)</a></li><li><a href=#tosabitwise_and-mlirtosabitwiseandop><code>tosa.bitwise_and</code> (mlir::tosa::BitwiseAndOp)</a></li><li><a href=#tosabitwise_not-mlirtosabitwisenotop><code>tosa.bitwise_not</code> (mlir::tosa::BitwiseNotOp)</a></li><li><a href=#tosabitwise_or-mlirtosabitwiseorop><code>tosa.bitwise_or</code> (mlir::tosa::BitwiseOrOp)</a></li><li><a href=#tosabitwise_xor-mlirtosabitwisexorop><code>tosa.bitwise_xor</code> (mlir::tosa::BitwiseXorOp)</a></li><li><a href=#tosacast-mlirtosacastop><code>tosa.cast</code> (mlir::tosa::CastOp)</a></li><li><a href=#tosaceil-mlirtosaceilop><code>tosa.ceil</code> (mlir::tosa::CeilOp)</a></li><li><a href=#tosaclamp-mlirtosaclampop><code>tosa.clamp</code> (mlir::tosa::ClampOp)</a></li><li><a href=#tosaclz-mlirtosaclzop><code>tosa.clz</code> (mlir::tosa::ClzOp)</a></li><li><a href=#tosaconcat-mlirtosaconcatop><code>tosa.concat</code> (mlir::tosa::ConcatOp)</a></li><li><a href=#tosaconst-mlirtosaconstop><code>tosa.const</code> (mlir::tosa::ConstOp)</a></li><li><a href=#tosaconv2d-mlirtosaconv2dop><code>tosa.conv2d</code> (mlir::tosa::Conv2DOp)</a></li><li><a href=#tosaconv3d-mlirtosaconv3dop><code>tosa.conv3d</code> (mlir::tosa::Conv3DOp)</a></li><li><a href=#tosacos-mlirtosacosop><code>tosa.cos</code> (mlir::tosa::CosOp)</a></li><li><a href=#tosacustom-mlirtosacustomop><code>tosa.custom</code> (mlir::tosa::CustomOp)</a></li><li><a href=#tosadepthwise_conv2d-mlirtosadepthwiseconv2dop><code>tosa.depthwise_conv2d</code> (mlir::tosa::DepthwiseConv2DOp)</a></li><li><a href=#tosaequal-mlirtosaequalop><code>tosa.equal</code> (mlir::tosa::EqualOp)</a></li><li><a href=#tosaerf-mlirtosaerfop><code>tosa.erf</code> (mlir::tosa::ErfOp)</a></li><li><a href=#tosaexp-mlirtosaexpop><code>tosa.exp</code> (mlir::tosa::ExpOp)</a></li><li><a href=#tosafft2d-mlirtosafft2dop><code>tosa.fft2d</code> (mlir::tosa::FFT2dOp)</a></li><li><a href=#tosafloor-mlirtosafloorop><code>tosa.floor</code> (mlir::tosa::FloorOp)</a></li><li><a href=#tosafully_connected-mlirtosafullyconnectedop><code>tosa.fully_connected</code> (mlir::tosa::FullyConnectedOp)</a></li><li><a href=#tosagather-mlirtosagatherop><code>tosa.gather</code> (mlir::tosa::GatherOp)</a></li><li><a href=#tosagreater_equal-mlirtosagreaterequalop><code>tosa.greater_equal</code> (mlir::tosa::GreaterEqualOp)</a></li><li><a href=#tosagreater-mlirtosagreaterop><code>tosa.greater</code> (mlir::tosa::GreaterOp)</a></li><li><a href=#tosaidentity-mlirtosaidentityop><code>tosa.identity</code> (mlir::tosa::IdentityOp)</a></li><li><a href=#tosacond_if-mlirtosaifop><code>tosa.cond_if</code> (mlir::tosa::IfOp)</a></li><li><a href=#tosaint_div-mlirtosaintdivop><code>tosa.int_div</code> (mlir::tosa::IntDivOp)</a></li><li><a href=#tosalog-mlirtosalogop><code>tosa.log</code> (mlir::tosa::LogOp)</a></li><li><a href=#tosalogical_and-mlirtosalogicalandop><code>tosa.logical_and</code> (mlir::tosa::LogicalAndOp)</a></li><li><a href=#tosalogical_left_shift-mlirtosalogicalleftshiftop><code>tosa.logical_left_shift</code> (mlir::tosa::LogicalLeftShiftOp)</a></li><li><a href=#tosalogical_not-mlirtosalogicalnotop><code>tosa.logical_not</code> (mlir::tosa::LogicalNotOp)</a></li><li><a href=#tosalogical_or-mlirtosalogicalorop><code>tosa.logical_or</code> (mlir::tosa::LogicalOrOp)</a></li><li><a href=#tosalogical_right_shift-mlirtosalogicalrightshiftop><code>tosa.logical_right_shift</code> (mlir::tosa::LogicalRightShiftOp)</a></li><li><a href=#tosalogical_xor-mlirtosalogicalxorop><code>tosa.logical_xor</code> (mlir::tosa::LogicalXorOp)</a></li><li><a href=#tosamatmul-mlirtosamatmulop><code>tosa.matmul</code> (mlir::tosa::MatMulOp)</a></li><li><a href=#tosamax_pool2d-mlirtosamaxpool2dop><code>tosa.max_pool2d</code> (mlir::tosa::MaxPool2dOp)</a></li><li><a href=#tosamaximum-mlirtosamaximumop><code>tosa.maximum</code> (mlir::tosa::MaximumOp)</a></li><li><a href=#tosaminimum-mlirtosaminimumop><code>tosa.minimum</code> (mlir::tosa::MinimumOp)</a></li><li><a href=#tosamul-mlirtosamulop><code>tosa.mul</code> (mlir::tosa::MulOp)</a></li><li><a href=#tosanegate-mlirtosanegateop><code>tosa.negate</code> (mlir::tosa::NegateOp)</a></li><li><a href=#tosapad-mlirtosapadop><code>tosa.pad</code> (mlir::tosa::PadOp)</a></li><li><a href=#tosapow-mlirtosapowop><code>tosa.pow</code> (mlir::tosa::PowOp)</a></li><li><a href=#tosarfft2d-mlirtosarfft2dop><code>tosa.rfft2d</code> (mlir::tosa::RFFT2dOp)</a></li><li><a href=#tosareciprocal-mlirtosareciprocalop><code>tosa.reciprocal</code> (mlir::tosa::ReciprocalOp)</a></li><li><a href=#tosareduce_all-mlirtosareduceallop><code>tosa.reduce_all</code> (mlir::tosa::ReduceAllOp)</a></li><li><a href=#tosareduce_any-mlirtosareduceanyop><code>tosa.reduce_any</code> (mlir::tosa::ReduceAnyOp)</a></li><li><a href=#tosareduce_max-mlirtosareducemaxop><code>tosa.reduce_max</code> (mlir::tosa::ReduceMaxOp)</a></li><li><a href=#tosareduce_min-mlirtosareduceminop><code>tosa.reduce_min</code> (mlir::tosa::ReduceMinOp)</a></li><li><a href=#tosareduce_prod-mlirtosareduceprodop><code>tosa.reduce_prod</code> (mlir::tosa::ReduceProdOp)</a></li><li><a href=#tosareduce_sum-mlirtosareducesumop><code>tosa.reduce_sum</code> (mlir::tosa::ReduceSumOp)</a></li><li><a href=#tosarescale-mlirtosarescaleop><code>tosa.rescale</code> (mlir::tosa::RescaleOp)</a></li><li><a href=#tosareshape-mlirtosareshapeop><code>tosa.reshape</code> (mlir::tosa::ReshapeOp)</a></li><li><a href=#tosaresize-mlirtosaresizeop><code>tosa.resize</code> (mlir::tosa::ResizeOp)</a></li><li><a href=#tosareverse-mlirtosareverseop><code>tosa.reverse</code> (mlir::tosa::ReverseOp)</a></li><li><a href=#tosarsqrt-mlirtosarsqrtop><code>tosa.rsqrt</code> (mlir::tosa::RsqrtOp)</a></li><li><a href=#tosascatter-mlirtosascatterop><code>tosa.scatter</code> (mlir::tosa::ScatterOp)</a></li><li><a href=#tosaselect-mlirtosaselectop><code>tosa.select</code> (mlir::tosa::SelectOp)</a></li><li><a href=#tosasigmoid-mlirtosasigmoidop><code>tosa.sigmoid</code> (mlir::tosa::SigmoidOp)</a></li><li><a href=#tosasin-mlirtosasinop><code>tosa.sin</code> (mlir::tosa::SinOp)</a></li><li><a href=#tosaslice-mlirtosasliceop><code>tosa.slice</code> (mlir::tosa::SliceOp)</a></li><li><a href=#tosasub-mlirtosasubop><code>tosa.sub</code> (mlir::tosa::SubOp)</a></li><li><a href=#tosatable-mlirtosatableop><code>tosa.table</code> (mlir::tosa::TableOp)</a></li><li><a href=#tosatanh-mlirtosatanhop><code>tosa.tanh</code> (mlir::tosa::TanhOp)</a></li><li><a href=#tosatile-mlirtosatileop><code>tosa.tile</code> (mlir::tosa::TileOp)</a></li><li><a href=#tosatranspose_conv2d-mlirtosatransposeconv2dop><code>tosa.transpose_conv2d</code> (mlir::tosa::TransposeConv2DOp)</a></li><li><a href=#tosatranspose-mlirtosatransposeop><code>tosa.transpose</code> (mlir::tosa::TransposeOp)</a></li><li><a href=#tosavariable-mlirtosavariableop><code>tosa.variable</code> (mlir::tosa::VariableOp)</a></li><li><a href=#tosavariableread-mlirtosavariablereadop><code>tosa.variable.read</code> (mlir::tosa::VariableReadOp)</a></li><li><a href=#tosavariablewrite-mlirtosavariablewriteop><code>tosa.variable.write</code> (mlir::tosa::VariableWriteOp)</a></li><li><a href=#tosawhile_loop-mlirtosawhileop><code>tosa.while_loop</code> (mlir::tosa::WhileOp)</a></li><li><a href=#tosayield-mlirtosayieldop><code>tosa.yield</code> (mlir::tosa::YieldOp)</a></li></ul></li></ul></nav><h2 id=rationale>Rationale <a class=headline-hash href=#rationale>¶</a></h2><p>The MLIR TOSA dialect implements the <a href=https://developer.mlplatform.org/w/tosa/>TOSA specification</a>. This document describes the decision process for how TOSA expresses operators in high level dialects.</p><p>TOSA was developed after parallel efforts to rationalize the top-down picture from multiple high-level frameworks, as well as a bottom-up view of different hardware target concerns (CPU, GPU and NPU), and reflects a set of choices that attempt to manage both sets of requirements.</p><h2 id=tosa-and-tensor-level-expressiveness>TOSA and Tensor Level Expressiveness <a class=headline-hash href=#tosa-and-tensor-level-expressiveness>¶</a></h2><p>TOSA endeavors to provide an operator set that tries to fulfil the following expressiveness goals at the <em>tensor level of abstraction</em> :</p><h3 id=complete>Complete <a class=headline-hash href=#complete>¶</a></h3><p>This is driven by the top-down perspective, needing to express as much of multiple high level frameworks fully in TOSA, as possible. This was originally done from an operator frequency analysis done upon dozens of high level networks in different frameworks, to select the most frequently occurring ones and establish a common set of tensor-level operators that could express them.</p><p>TOSA categorizes its operator set into classes and attempts to address major functional operations at the tensor level, including compute, reduction, elementwise transformations, comparison and control flow.</p><h3 id=minimal>Minimal <a class=headline-hash href=#minimal>¶</a></h3><p>This takes the bottom-up approach - keep the TOSA operator set minimal in order to bound the design of hardware, operator kernels, code generation strategies and associated considerations that effect the executability of TOSA content.</p><p>In this regard TOSA seeks to avoid creating compound operators, instead leaving it to compiler backend to fuse multiple TOSA ops if required. This choice also benefits the numerical precision goal, since it is easier to fuse the numerical functionality of successive operators, than to split the numerical functionality of a compound operator.</p><h3 id=numerical-precision>Numerical Precision <a class=headline-hash href=#numerical-precision>¶</a></h3><p>TOSA began as a means to address operator-level numerical precision for code generation and hardware development. It therefore incorporates precision detail into the operator set.</p><p>In this regard, TOSA operators are best understood as a combination of the visible quantization information embedded within an operation, together with the functional information about how that information is used, as described in the specification of the operation.</p><h2 id=tosa-operator-rationale>TOSA Operator Rationale <a class=headline-hash href=#tosa-operator-rationale>¶</a></h2><p>The general basis of selection of the operator set that constitutes TOSA is described in the TOSA specification document under Section 1.3 Operator Selection. Explanation of the thinking behind some operators is listed here:</p><h3 id=cond_if-and-while_loop>COND_IF and WHILE_LOOP <a class=headline-hash href=#cond_if-and-while_loop>¶</a></h3><p>Several neural networks express conditional control flow at the tensor level. A survey of multiple high level frameworks indicated that conditional if and a loop construct are common in all major frameworks, with some variation. Since TOSA endeavors to be complete in expressing tensor level functionality including control flow, it implements these constructs.</p><p>The COND_IF and WHILE_LOOP operators implement such structured control flow forms and should be lowerable to corresponding ops in the scf dialect. Since the dialect seeks to remain isomorphic with an external, serialized form, the decision was to keep these ops in the dialect (as opposed to deferring completely to scf), and this may be re-evaluated if this turns out to not yield the expected value.</p><h2 id=using-tosa-in-a-compiler>Using TOSA In A Compiler <a class=headline-hash href=#using-tosa-in-a-compiler>¶</a></h2><p>The TOSA specification describes each operator in functional detail. It is expected that compilers that use TOSA will use its builders to construct the operators so that the quantization information for the operator is correctly generated.</p><p>The functional steps described in the pseudocode of the specification enables the construction of code generation for that operation, or decisions on the design of underlying hardware. The functional pseudocode also describes how the quantization parameters are utilized within the operation.</p><h3 id=quantization-parameters-in-ops-vs-tensors>Quantization Parameters in Ops vs Tensors <a class=headline-hash href=#quantization-parameters-in-ops-vs-tensors>¶</a></h3><p>TOSA uses the quantization parameters embedded in the input and output tensors to construct the quantization attributes that sit within the operator. Once these attributes are constructed, the quantization information within the tensors are no longer necessary for code generation.</p><p>This enables the tensors to be subsequently interpreted simply as contiguous buffers containing raw data, with no ‘meta information’ in the form of the quantization_type. Precision related manipulation of the input or output are instead described by the operator itself which describes, for example, when the zero point is applied, or when the scale multiplication is done.</p><p>However, TOSA does <em>not</em> eliminate the existing MLIR QuantOps quantization type information within the tensors; this leaves the choice of how to handle quantization information, to later backend code generation steps.</p><p>Maintaining the ability to overlap these different representations of quantization parameters (i.e. tensor-carried vs op-carried) is an important capability when considering progressive lowering between uses that expect one scheme vs the other.</p><h2 id=operation-definitions>Operation definitions <a class=headline-hash href=#operation-definitions>¶</a></h2><p><a href=https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td>source</a></p><h3 id=tosaabs-mlirtosaabsop><code>tosa.abs</code> (mlir::tosa::AbsOp) <a class=headline-hash href=#tosaabs-mlirtosaabsop>¶</a></h3><p><em>Elementwise abs op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.abs` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise absolute value operation</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl><span class=nv>%out</span> <span class=p>=</span> tosa<span class=p>.</span>abs<span class=p>(</span><span class=nv>%in</span><span class=p>)</span> <span class=p>:</span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>21x3x</span><span class=k>f32</span><span class=p>>)</span> <span class=p>-></span> <span class=kt>tensor</span><span class=p><</span><span class=m>21x3x</span><span class=k>f32</span><span class=p>></span> </span></span></code></pre></div><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands>Operands: <a class=headline-hash href=#operands>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results>Results: <a class=headline-hash href=#results>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaadd-mlirtosaaddop><code>tosa.add</code> (mlir::tosa::AddOp) <a class=headline-hash href=#tosaadd-mlirtosaaddop>¶</a></h3><p><em>Elementwise addition operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.add` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise addition of input1 and input2. Axis of size 1 will be broadcast, as necessary.</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl><span class=c>// Elementwise addition. </span></span></span><span class=line><span class=cl><span class=c></span><span class=nv>%out</span> <span class=p>=</span> tosa<span class=p>.</span>add <span class=nv>%in1</span><span class=p>,</span> <span class=nv>%in2</span> <span class=p>:</span> <span class=kt>tensor</span><span class=p><</span><span class=m>12x6x</span><span class=k>f32</span><span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>12x6x</span><span class=k>f32</span><span class=p>></span> <span class=p>-></span> <span class=kt>tensor</span><span class=p><</span><span class=m>12x6x</span><span class=k>f32</span><span class=p>></span> </span></span><span class=line><span class=cl> </span></span><span class=line><span class=cl><span class=c>// Elementwise addition with broadcasting. </span></span></span><span class=line><span class=cl><span class=c></span><span class=nv>%out</span> <span class=p>=</span> tosa<span class=p>.</span>add <span class=nv>%in1</span><span class=p>,</span> <span class=nv>%in2</span> <span class=p>:</span> <span class=kt>tensor</span><span class=p><</span><span class=m>12x6x</span>si32<span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>1x1x</span>si32<span class=p>></span> <span class=p>-></span> <span class=kt>tensor</span><span class=p><</span><span class=m>12x6x</span>si32<span class=p>></span> </span></span></code></pre></div><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-1>Operands: <a class=headline-hash href=#operands-1>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-1>Results: <a class=headline-hash href=#results-1>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaapply_scale-mlirtosaapplyscaleop><code>tosa.apply_scale</code> (mlir::tosa::ApplyScaleOp) <a class=headline-hash href=#tosaapply_scale-mlirtosaapplyscaleop>¶</a></h3><p><em>Rescale scalar operator for Tosa tensor operators</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.apply_scale` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Applies rescaling for fixed point values. This behavior is replicated in multiple quantized operations (mul, convolution, rescale, matmul, pooling).</p><p>The commonplace implementation is to use i64 operations to avoid integer overflow with target specific implementations can use native operations to avoid wider than necessary types.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Elementwise</code>, <code>Scalarizable</code>, <code>Tensorizable</code>, <code>Vectorizable</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code>, <code>VectorUnrollOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes>Attributes: <a class=headline-hash href=#attributes>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>double_round</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-2>Operands: <a class=headline-hash href=#operands-2>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>value</code></td><td>signless-integer-like</td></tr><tr><td style=text-align:center><code>multiplier</code></td><td>signless-integer-like</td></tr><tr><td style=text-align:center><code>shift</code></td><td>signless-integer-8-bit-like</td></tr></tbody></table><h4 id=results-2>Results: <a class=headline-hash href=#results-2>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>signless-integer-like</td></tr></tbody></table><h3 id=tosaargmax-mlirtosaargmaxop><code>tosa.argmax</code> (mlir::tosa::ArgMaxOp) <a class=headline-hash href=#tosaargmax-mlirtosaargmaxop>¶</a></h3><p><em>Perform argmax on the input.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.argmax` operands attr-dict `:` functional-type(operands, results) </code></pre><p>This returns the index with the largest value across the given axis of the input tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-1>Attributes: <a class=headline-hash href=#attributes-1>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-3>Operands: <a class=headline-hash href=#operands-3>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-3>Results: <a class=headline-hash href=#results-3>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaarithmetic_right_shift-mlirtosaarithmeticrightshiftop><code>tosa.arithmetic_right_shift</code> (mlir::tosa::ArithmeticRightShiftOp) <a class=headline-hash href=#tosaarithmetic_right_shift-mlirtosaarithmeticrightshiftop>¶</a></h3><p><em>Elementwise Arithmetic Right Shift</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.arithmetic_right_shift` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise arithmetic right shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-2>Attributes: <a class=headline-hash href=#attributes-2>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>round</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-4>Operands: <a class=headline-hash href=#operands-4>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-4>Results: <a class=headline-hash href=#results-4>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaavg_pool2d-mlirtosaavgpool2dop><code>tosa.avg_pool2d</code> (mlir::tosa::AvgPool2dOp) <a class=headline-hash href=#tosaavg_pool2d-mlirtosaavgpool2dop>¶</a></h3><p><em>Performs average pooling on the input.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.avg_pool2d` operands attr-dict `:` functional-type(operands, results) </code></pre><p>This performs an average pooling over the given input tensor. A sliding window of size given by <kernel size>is passed over the input tensor, with the mean value being placed in the output tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-3>Attributes: <a class=headline-hash href=#attributes-3>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>kernel</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>stride</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>pad</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr><tr><td><code>acc_type</code></td><td>::mlir::TypeAttr</td><td>type attribute of 32-bit signless integer or 32-bit signed integer or 16-bit float or 32-bit float</td></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::UnaryOpQuantizationAttr</td><td>Attribute for UnaryOp quantization information.</td></tr></table><h4 id=operands-5>Operands: <a class=headline-hash href=#operands-5>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-5>Results: <a class=headline-hash href=#results-5>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosabitwise_and-mlirtosabitwiseandop><code>tosa.bitwise_and</code> (mlir::tosa::BitwiseAndOp) <a class=headline-hash href=#tosabitwise_and-mlirtosabitwiseandop>¶</a></h3><p><em>Bitwise AND operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.bitwise_and` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise bitwise AND of input1 and input2. Axis of size 1 will be broadcast as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-6>Operands: <a class=headline-hash href=#operands-6>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-6>Results: <a class=headline-hash href=#results-6>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosabitwise_not-mlirtosabitwisenotop><code>tosa.bitwise_not</code> (mlir::tosa::BitwiseNotOp) <a class=headline-hash href=#tosabitwise_not-mlirtosabitwisenotop>¶</a></h3><p><em>Bitwise NOT operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.bitwise_not` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise bitwise NOT of input tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-7>Operands: <a class=headline-hash href=#operands-7>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-7>Results: <a class=headline-hash href=#results-7>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosabitwise_or-mlirtosabitwiseorop><code>tosa.bitwise_or</code> (mlir::tosa::BitwiseOrOp) <a class=headline-hash href=#tosabitwise_or-mlirtosabitwiseorop>¶</a></h3><p><em>Bitwise OR operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.bitwise_or` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise bitwise OR of input1 and input2. Axis of size 1 will be broadcast as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-8>Operands: <a class=headline-hash href=#operands-8>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-8>Results: <a class=headline-hash href=#results-8>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosabitwise_xor-mlirtosabitwisexorop><code>tosa.bitwise_xor</code> (mlir::tosa::BitwiseXorOp) <a class=headline-hash href=#tosabitwise_xor-mlirtosabitwisexorop>¶</a></h3><p><em>Bitwise XOR operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.bitwise_xor` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise bitwise XOR of input1 and input2. Axis of size 1 will be broadcast as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-9>Operands: <a class=headline-hash href=#operands-9>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-9>Results: <a class=headline-hash href=#results-9>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosacast-mlirtosacastop><code>tosa.cast</code> (mlir::tosa::CastOp) <a class=headline-hash href=#tosacast-mlirtosacastop>¶</a></h3><p><em>Cast operation</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.cast` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs a set of permissible cast operations</p><table><thead><tr><th>Mode</th><th>Input</th><th>Output</th></tr></thead><tbody><tr><td>signed 8 to bool</td><td>int8</td><td>Boolean</td></tr><tr><td>signed 16 to bool</td><td>int16</td><td>Boolean</td></tr><tr><td>signed 32 to bool</td><td>int32</td><td>Boolean</td></tr><tr><td>bool to 8</td><td>Boolean</td><td>int8</td></tr><tr><td>bool to 16</td><td>Boolean</td><td>int16</td></tr><tr><td>bool to 32</td><td>Boolean</td><td>int32</td></tr><tr><td>signed 8 to signed 16</td><td>int8</td><td>int16</td></tr><tr><td>signed 8 to signed 32</td><td>int8</td><td>int32</td></tr><tr><td>signed 16 to signed 8</td><td>int16</td><td>int8</td></tr><tr><td>signed 16 to signed 32</td><td>int16</td><td>int32</td></tr><tr><td>signed 32 to signed 8</td><td>int32</td><td>int8</td></tr><tr><td>signed 32 to signed 16</td><td>int32</td><td>int16</td></tr><tr><td>float to signed 8</td><td>float</td><td>int8</td></tr><tr><td>float to signed 16</td><td>float</td><td>int16</td></tr><tr><td>signed 8 to float</td><td>int8</td><td>float</td></tr><tr><td>signed 16 to float</td><td>int16</td><td>float</td></tr><tr><td>float 32 to float 64</td><td>float32</td><td>float64</td></tr><tr><td>float 64 to float 32</td><td>float64</td><td>float32</td></tr></tbody></table><p>Traits: <code>AlwaysSpeculatableImplTrait</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-10>Operands: <a class=headline-hash href=#operands-10>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-10>Results: <a class=headline-hash href=#results-10>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaceil-mlirtosaceilop><code>tosa.ceil</code> (mlir::tosa::CeilOp) <a class=headline-hash href=#tosaceil-mlirtosaceilop>¶</a></h3><p><em>Elementwise ceil op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.ceil` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise ceiling operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-11>Operands: <a class=headline-hash href=#operands-11>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-11>Results: <a class=headline-hash href=#results-11>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaclamp-mlirtosaclampop><code>tosa.clamp</code> (mlir::tosa::ClampOp) <a class=headline-hash href=#tosaclamp-mlirtosaclampop>¶</a></h3><p><em>Computes clamp(features, min, max).</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.clamp` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Clamp to an arbitrary minimum and maximum value. Maximum and minimum values are specified as values in the range of the input type. No zero point subtraction is done to the values, thus to clamp to the zero point value, the zero point itself should be supplied as the minimum value.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-4>Attributes: <a class=headline-hash href=#attributes-4>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>min_int</code></td><td>::mlir::IntegerAttr</td><td>64-bit signless integer attribute</td></tr><tr><td><code>max_int</code></td><td>::mlir::IntegerAttr</td><td>64-bit signless integer attribute</td></tr><tr><td><code>min_fp</code></td><td>::mlir::FloatAttr</td><td>arbitrary float attribute</td></tr><tr><td><code>max_fp</code></td><td>::mlir::FloatAttr</td><td>arbitrary float attribute</td></tr></table><h4 id=operands-12>Operands: <a class=headline-hash href=#operands-12>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-12>Results: <a class=headline-hash href=#results-12>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaclz-mlirtosaclzop><code>tosa.clz</code> (mlir::tosa::ClzOp) <a class=headline-hash href=#tosaclz-mlirtosaclzop>¶</a></h3><p><em>Elementwise count leading zero op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.clz` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise count leading zeros operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-13>Operands: <a class=headline-hash href=#operands-13>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-13>Results: <a class=headline-hash href=#results-13>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaconcat-mlirtosaconcatop><code>tosa.concat</code> (mlir::tosa::ConcatOp) <a class=headline-hash href=#tosaconcat-mlirtosaconcatop>¶</a></h3><p><em>Concatenates tensors along one dimension.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.concat` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Concatenate a variadic amount of tensors along a given axis. No data conversion happens during a concat operation.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-5>Attributes: <a class=headline-hash href=#attributes-5>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-14>Operands: <a class=headline-hash href=#operands-14>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-14>Results: <a class=headline-hash href=#results-14>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaconst-mlirtosaconstop><code>tosa.const</code> (mlir::tosa::ConstOp) <a class=headline-hash href=#tosaconst-mlirtosaconstop>¶</a></h3><p><em>Constant op.</em></p><p>A node containing constant data for use as the input to an operation. May hold data in any of the supported data formats.</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl><span class=c>// Generic form </span></span></span><span class=line><span class=cl><span class=c></span><span class=nv>%out</span> <span class=p>=</span> <span class=s>"tosa.const"</span><span class=p>()</span> <span class=p>{</span><span class=nl>value =</span> dense<span class=p><</span><span class=m>0</span><span class=p>></span> <span class=p>:</span> <span class=kt>tensor</span><span class=p><</span><span class=m>2x3x</span><span class=k>i32</span><span class=p>>}</span> <span class=p>:</span> <span class=p>()</span> <span class=p>-></span> <span class=kt>tensor</span><span class=p><</span><span class=m>2x3x</span><span class=k>i32</span><span class=p>></span> </span></span></code></pre></div><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ConstantLike</code>, <code>FirstAttrDerivedResultType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-6>Attributes: <a class=headline-hash href=#attributes-6>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>value</code></td><td>::mlir::ElementsAttr</td><td>constant vector/tensor attribute</td></tr></table><h4 id=results-15>Results: <a class=headline-hash href=#results-15>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaconv2d-mlirtosaconv2dop><code>tosa.conv2d</code> (mlir::tosa::Conv2DOp) <a class=headline-hash href=#tosaconv2d-mlirtosaconv2dop>¶</a></h3><p><em>2D Convolution Operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.conv2d` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs a 2D convolution over the given tensor input, using the weight tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-7>Attributes: <a class=headline-hash href=#attributes-7>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>pad</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr><tr><td><code>stride</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>dilation</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::ConvOpQuantizationAttr</td><td>Attribute for Conv type op quantization information.</td></tr><tr><td><code>local_bound</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-15>Operands: <a class=headline-hash href=#operands-15>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>4-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>weight</code></td><td>4D tensor of 4-bit signless integer or 8-bit signless integer or Quint8 type or Qint4 type or Qint8 type or Qint16 type or Qint32 type or floating-point values</td></tr><tr><td style=text-align:center><code>bias</code></td><td>1-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-16>Results: <a class=headline-hash href=#results-16>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosaconv3d-mlirtosaconv3dop><code>tosa.conv3d</code> (mlir::tosa::Conv3DOp) <a class=headline-hash href=#tosaconv3d-mlirtosaconv3dop>¶</a></h3><p><em>3D Convolution operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.conv3d` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs a 3D convolution over the given input tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-8>Attributes: <a class=headline-hash href=#attributes-8>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>pad</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 6 elements</td></tr><tr><td><code>stride</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 3 elements</td></tr><tr><td><code>dilation</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 3 elements</td></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::ConvOpQuantizationAttr</td><td>Attribute for Conv type op quantization information.</td></tr><tr><td><code>local_bound</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-16>Operands: <a class=headline-hash href=#operands-16>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>5-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>weight</code></td><td>5D tensor of 4-bit signless integer or 8-bit signless integer or Quint8 type or Qint4 type or Qint8 type or Qint16 type or Qint32 type or floating-point values</td></tr><tr><td style=text-align:center><code>bias</code></td><td>1-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-17>Results: <a class=headline-hash href=#results-17>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>5-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosacos-mlirtosacosop><code>tosa.cos</code> (mlir::tosa::CosOp) <a class=headline-hash href=#tosacos-mlirtosacosop>¶</a></h3><p><em>Elementwise cos op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.cos` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise cosine operation for values given in radians.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-17>Operands: <a class=headline-hash href=#operands-17>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of floating-point values</td></tr></tbody></table><h4 id=results-18>Results: <a class=headline-hash href=#results-18>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of floating-point values</td></tr></tbody></table><h3 id=tosacustom-mlirtosacustomop><code>tosa.custom</code> (mlir::tosa::CustomOp) <a class=headline-hash href=#tosacustom-mlirtosacustomop>¶</a></h3><p><em>Custom operator wrapper for Tosa</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.custom` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Hardware implementing TOSA may choose to add additional custom operators that are not expressed in the existing TOSA operations. These operators are not expected to be portable across TOSA implementations. The input and output signatures must be expressed in the corresponding TOSA node.</p><p><code>operator_name</code> is a string that tells the backend which custom operator is being called.</p><p><code>domain_name</code> is a string identifier which can help avoid name collisions on the identifier field.</p><p><code>implementation_attrs</code> is a string which is a backend and identifier specific set of attributes to the custom operator.</p><p><code>inputs</code> is the set of tensor inputs to the custom operator.</p><p>`outputs is the list of tensors returned by the operator. The number of operators is backend specific.</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl><span class=nv>%out</span> <span class=p>=</span> tosa<span class=p>.</span>custom <span class=nv>%in</span> <span class=p>{</span><span class=nl>domain_name =</span> <span class=s>"tosa_mlir_test"</span><span class=p>,</span> <span class=nl>operator_name =</span> </span></span><span class=line><span class=cl> <span class=s>"custom_test"</span><span class=p>,</span> <span class=nl>implementation_attrs =</span> <span class=s>""</span><span class=p>}:</span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>10x</span><span class=k>i32</span><span class=p>>)</span> <span class=p>-></span> </span></span><span class=line><span class=cl> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>10x</span><span class=k>i32</span><span class=p>>)</span> </span></span></code></pre></div><p>Interfaces: <code>TosaOpInterface</code></p><h4 id=attributes-9>Attributes: <a class=headline-hash href=#attributes-9>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>operator_name</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr><tr><td><code>domain_name</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr><tr><td><code>implementation_attrs</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr></table><h4 id=operands-18>Operands: <a class=headline-hash href=#operands-18>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>inputs</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-19>Results: <a class=headline-hash href=#results-19>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>outputs</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosadepthwise_conv2d-mlirtosadepthwiseconv2dop><code>tosa.depthwise_conv2d</code> (mlir::tosa::DepthwiseConv2DOp) <a class=headline-hash href=#tosadepthwise_conv2d-mlirtosadepthwiseconv2dop>¶</a></h3><p><em>Depthwise 2D Convolution operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.depthwise_conv2d` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs 2D convolutions separately over each channel of the given tensor input, using the weight tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-10>Attributes: <a class=headline-hash href=#attributes-10>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>pad</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr><tr><td><code>stride</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>dilation</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::ConvOpQuantizationAttr</td><td>Attribute for Conv type op quantization information.</td></tr><tr><td><code>local_bound</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-19>Operands: <a class=headline-hash href=#operands-19>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>4-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>weight</code></td><td>4D tensor of 4-bit signless integer or 8-bit signless integer or Quint8 type or Qint4 type or Qint8 type or Qint16 type or Qint32 type or floating-point values</td></tr><tr><td style=text-align:center><code>bias</code></td><td>1-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-20>Results: <a class=headline-hash href=#results-20>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosaequal-mlirtosaequalop><code>tosa.equal</code> (mlir::tosa::EqualOp) <a class=headline-hash href=#tosaequal-mlirtosaequalop>¶</a></h3><p><em>Returns the truth value of (x == y) element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.equal` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise comparison operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>InferTensorType</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-20>Operands: <a class=headline-hash href=#operands-20>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-21>Results: <a class=headline-hash href=#results-21>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosaerf-mlirtosaerfop><code>tosa.erf</code> (mlir::tosa::ErfOp) <a class=headline-hash href=#tosaerf-mlirtosaerfop>¶</a></h3><p><em>Computes gauss error function of input</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.erf` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Gauss error function: $ erf(x) = \frac{2}{\sqrt(\pi)} \int_{0}^{x} e^{-t^2} ,dt $ For quantized integer data types, the TABLE operator should be used instead with the following definition. The erf_table has 513 entries each of 16-bit/8-bit precision and covering the input range -4.0 to +4.0 in steps of 1/64.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-21>Operands: <a class=headline-hash href=#operands-21>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-22>Results: <a class=headline-hash href=#results-22>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaexp-mlirtosaexpop><code>tosa.exp</code> (mlir::tosa::ExpOp) <a class=headline-hash href=#tosaexp-mlirtosaexpop>¶</a></h3><p><em>Elementwise exp op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.exp` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise e to the x operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-22>Operands: <a class=headline-hash href=#operands-22>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-23>Results: <a class=headline-hash href=#results-23>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosafft2d-mlirtosafft2dop><code>tosa.fft2d</code> (mlir::tosa::FFT2dOp) <a class=headline-hash href=#tosafft2d-mlirtosafft2dop>¶</a></h3><p><em>Performs FFT2D operation on the input.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.fft2d` $input_real `,` $input_imag attr-dict `:` `(` type($input_real) `,` type($input_imag) `)` `->` `(` type($output_real) `,` type($output_imag) `)` </code></pre><p>Performs a batched complex 2D Fast Fourier Transform over the input. The complex input values are constructed from the corresponding values in the input_real and input_imag tensors. The resulting values in the output are split into the output_real and output_imag tensors. No normalization is applied on either the forward or inverse versions of the operation.</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl> <span class=nv>%out_real</span><span class=p>,</span> <span class=nv>%out_imag</span> <span class=p>=</span> tosa<span class=p>.</span>fft2d <span class=nv>%in_real</span><span class=p>,</span> <span class=nv>%in_imag</span> <span class=p>:</span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>8x9x</span><span class=k>f32</span><span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>8x9x</span><span class=k>f32</span><span class=p>>)</span> <span class=p>-></span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>8x9x</span><span class=k>f32</span><span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>8x9x</span><span class=k>f32</span><span class=p>>)</span> </span></span></code></pre></div><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-11>Attributes: <a class=headline-hash href=#attributes-11>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>inverse</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr><tr><td><code>local_bound</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-23>Operands: <a class=headline-hash href=#operands-23>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input_real</code></td><td>3-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>input_imag</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-24>Results: <a class=headline-hash href=#results-24>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output_real</code></td><td>3-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>output_imag</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosafloor-mlirtosafloorop><code>tosa.floor</code> (mlir::tosa::FloorOp) <a class=headline-hash href=#tosafloor-mlirtosafloorop>¶</a></h3><p><em>Elementwise floor op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.floor` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise floor operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-24>Operands: <a class=headline-hash href=#operands-24>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-25>Results: <a class=headline-hash href=#results-25>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosafully_connected-mlirtosafullyconnectedop><code>tosa.fully_connected</code> (mlir::tosa::FullyConnectedOp) <a class=headline-hash href=#tosafully_connected-mlirtosafullyconnectedop>¶</a></h3><p><em>Fully Connected operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.fully_connected` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs a fully connected network.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-12>Attributes: <a class=headline-hash href=#attributes-12>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::ConvOpQuantizationAttr</td><td>Attribute for Conv type op quantization information.</td></tr></table><h4 id=operands-25>Operands: <a class=headline-hash href=#operands-25>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>2-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>weight</code></td><td>2D tensor of 4-bit signless integer or 8-bit signless integer or Quint8 type or Qint4 type or Qint8 type or Qint16 type or Qint32 type or floating-point values</td></tr><tr><td style=text-align:center><code>bias</code></td><td>1-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-26>Results: <a class=headline-hash href=#results-26>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>2-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosagather-mlirtosagatherop><code>tosa.gather</code> (mlir::tosa::GatherOp) <a class=headline-hash href=#tosagather-mlirtosagatherop>¶</a></h3><p><em>Gather operation,</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.gather` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Generate a tensor for which each element in the output is a slice of the values tensor based on the value of indices.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-26>Operands: <a class=headline-hash href=#operands-26>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>values</code></td><td>3-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>indices</code></td><td>2D tensor of 32-bit signless integer values</td></tr></tbody></table><h4 id=results-27>Results: <a class=headline-hash href=#results-27>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosagreater_equal-mlirtosagreaterequalop><code>tosa.greater_equal</code> (mlir::tosa::GreaterEqualOp) <a class=headline-hash href=#tosagreater_equal-mlirtosagreaterequalop>¶</a></h3><p><em>Returns the truth value of (x >= y) element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.greater_equal` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise comparison operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-27>Operands: <a class=headline-hash href=#operands-27>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-28>Results: <a class=headline-hash href=#results-28>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosagreater-mlirtosagreaterop><code>tosa.greater</code> (mlir::tosa::GreaterOp) <a class=headline-hash href=#tosagreater-mlirtosagreaterop>¶</a></h3><p><em>Returns the truth value of (x > y) element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.greater` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise greater than comparison operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-28>Operands: <a class=headline-hash href=#operands-28>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-29>Results: <a class=headline-hash href=#results-29>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosaidentity-mlirtosaidentityop><code>tosa.identity</code> (mlir::tosa::IdentityOp) <a class=headline-hash href=#tosaidentity-mlirtosaidentityop>¶</a></h3><p><em>Identity operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.identity` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Returns a tensor with the same shape, size, type and content as the input.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-29>Operands: <a class=headline-hash href=#operands-29>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-30>Results: <a class=headline-hash href=#results-30>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosacond_if-mlirtosaifop><code>tosa.cond_if</code> (mlir::tosa::IfOp) <a class=headline-hash href=#tosacond_if-mlirtosaifop>¶</a></h3><p><em>Conditional if operator</em></p><p>Evaluates a Boolean condition and then takes one of two distinct execution paths. This implements the semantic If-then-else structure.</p><p>Traits: <code>InferShapedTypeOpAdaptor</code>, <code>RecursiveMemoryEffects</code>, <code>SingleBlockImplicitTerminator<YieldOp></code>, <code>SingleBlock</code></p><p>Interfaces: <code>InferShapedTypeOpInterface</code>, <code>TosaOpInterface</code></p><h4 id=operands-30>Operands: <a class=headline-hash href=#operands-30>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>cond</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr><tr><td style=text-align:center><code>inputs</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-31>Results: <a class=headline-hash href=#results-31>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaint_div-mlirtosaintdivop><code>tosa.int_div</code> (mlir::tosa::IntDivOp) <a class=headline-hash href=#tosaint_div-mlirtosaintdivop>¶</a></h3><p><em>Integer divide operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.int_div` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise integer divide operator of input1 by input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-31>Operands: <a class=headline-hash href=#operands-31>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of 32-bit signless integer values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of 32-bit signless integer values</td></tr></tbody></table><h4 id=results-32>Results: <a class=headline-hash href=#results-32>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of 32-bit signless integer values</td></tr></tbody></table><h3 id=tosalog-mlirtosalogop><code>tosa.log</code> (mlir::tosa::LogOp) <a class=headline-hash href=#tosalog-mlirtosalogop>¶</a></h3><p><em>Elementwise log op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.log` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise natural logarithm operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-32>Operands: <a class=headline-hash href=#operands-32>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-33>Results: <a class=headline-hash href=#results-33>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosalogical_and-mlirtosalogicalandop><code>tosa.logical_and</code> (mlir::tosa::LogicalAndOp) <a class=headline-hash href=#tosalogical_and-mlirtosalogicalandop>¶</a></h3><p><em>Returns the truth value of x AND y element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.logical_and` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise logical AND of input1 and input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-33>Operands: <a class=headline-hash href=#operands-33>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h4 id=results-34>Results: <a class=headline-hash href=#results-34>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>z</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosalogical_left_shift-mlirtosalogicalleftshiftop><code>tosa.logical_left_shift</code> (mlir::tosa::LogicalLeftShiftOp) <a class=headline-hash href=#tosalogical_left_shift-mlirtosalogicalleftshiftop>¶</a></h3><p><em>Elementwise Logical Left Shift</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.logical_left_shift` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise left shift of input1 and input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-34>Operands: <a class=headline-hash href=#operands-34>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-35>Results: <a class=headline-hash href=#results-35>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosalogical_not-mlirtosalogicalnotop><code>tosa.logical_not</code> (mlir::tosa::LogicalNotOp) <a class=headline-hash href=#tosalogical_not-mlirtosalogicalnotop>¶</a></h3><p><em>Returns the truth value of NOT x element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.logical_not` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise logical NOT of input.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-35>Operands: <a class=headline-hash href=#operands-35>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h4 id=results-36>Results: <a class=headline-hash href=#results-36>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosalogical_or-mlirtosalogicalorop><code>tosa.logical_or</code> (mlir::tosa::LogicalOrOp) <a class=headline-hash href=#tosalogical_or-mlirtosalogicalorop>¶</a></h3><p><em>Returns the truth value of x OR y element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.logical_or` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise logical OR of input1 and input2. Axis of size 1 will be broadcast as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-36>Operands: <a class=headline-hash href=#operands-36>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h4 id=results-37>Results: <a class=headline-hash href=#results-37>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>z</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosalogical_right_shift-mlirtosalogicalrightshiftop><code>tosa.logical_right_shift</code> (mlir::tosa::LogicalRightShiftOp) <a class=headline-hash href=#tosalogical_right_shift-mlirtosalogicalrightshiftop>¶</a></h3><p><em>Elementwise Logical Right Shift</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.logical_right_shift` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise logical right shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-37>Operands: <a class=headline-hash href=#operands-37>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-38>Results: <a class=headline-hash href=#results-38>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosalogical_xor-mlirtosalogicalxorop><code>tosa.logical_xor</code> (mlir::tosa::LogicalXorOp) <a class=headline-hash href=#tosalogical_xor-mlirtosalogicalxorop>¶</a></h3><p><em>Returns the truth value of x XOR y element-wise.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.logical_xor` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise logical XOR of input1 and input2. Axis of size 1 will be broadcast as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-38>Operands: <a class=headline-hash href=#operands-38>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h4 id=results-39>Results: <a class=headline-hash href=#results-39>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>z</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr></tbody></table><h3 id=tosamatmul-mlirtosamatmulop><code>tosa.matmul</code> (mlir::tosa::MatMulOp) <a class=headline-hash href=#tosamatmul-mlirtosamatmulop>¶</a></h3><p><em>Matrix multiplication with bias</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.matmul` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs a two dimensional matrix multiplication. This allows both inputs to be activations, rather than reserving weights as an attribute in the FULLY_CONNECTED operator.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-13>Attributes: <a class=headline-hash href=#attributes-13>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::MatMulOpQuantizationAttr</td><td>Attribute for MatMulOp quantization information.</td></tr></table><h4 id=operands-39>Operands: <a class=headline-hash href=#operands-39>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>a</code></td><td>3-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>b</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-40>Results: <a class=headline-hash href=#results-40>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>c</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosamax_pool2d-mlirtosamaxpool2dop><code>tosa.max_pool2d</code> (mlir::tosa::MaxPool2dOp) <a class=headline-hash href=#tosamax_pool2d-mlirtosamaxpool2dop>¶</a></h3><p><em>Performs max pooling on the input.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.max_pool2d` operands attr-dict `:` functional-type(operands, results) </code></pre><p>This performs a max pooling over the given input tensor. A sliding window of size given by <kernel size>is passed over the input tensor, with the maximum value being placed in the output tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-14>Attributes: <a class=headline-hash href=#attributes-14>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>kernel</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>stride</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>pad</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr></table><h4 id=operands-40>Operands: <a class=headline-hash href=#operands-40>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-41>Results: <a class=headline-hash href=#results-41>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosamaximum-mlirtosamaximumop><code>tosa.maximum</code> (mlir::tosa::MaximumOp) <a class=headline-hash href=#tosamaximum-mlirtosamaximumop>¶</a></h3><p><em>Elementwise Maximum</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.maximum` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise max of input1 and input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-41>Operands: <a class=headline-hash href=#operands-41>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-42>Results: <a class=headline-hash href=#results-42>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosaminimum-mlirtosaminimumop><code>tosa.minimum</code> (mlir::tosa::MinimumOp) <a class=headline-hash href=#tosaminimum-mlirtosaminimumop>¶</a></h3><p><em>Elementwise Minimum</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.minimum` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise minimum of input1 and input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-42>Operands: <a class=headline-hash href=#operands-42>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-43>Results: <a class=headline-hash href=#results-43>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosamul-mlirtosamulop><code>tosa.mul</code> (mlir::tosa::MulOp) <a class=headline-hash href=#tosamul-mlirtosamulop>¶</a></h3><p><em>Multiplication operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.mul` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise multiplication (Hadamard product) of input1 and input2. Axis of size 1 will be broadcast, as necessary. i8/i16 input type can be promoted to i32 result type.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Commutative</code>, <code>MulOperandsAndResultElementType</code>, <code>ResultsBroadcastableShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-15>Attributes: <a class=headline-hash href=#attributes-15>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>shift</code></td><td>::mlir::IntegerAttr</td><td>8-bit signless integer attribute</td></tr></table><h4 id=operands-43>Operands: <a class=headline-hash href=#operands-43>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-44>Results: <a class=headline-hash href=#results-44>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosanegate-mlirtosanegateop><code>tosa.negate</code> (mlir::tosa::NegateOp) <a class=headline-hash href=#tosanegate-mlirtosanegateop>¶</a></h3><p><em>Elementwise negate op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.negate` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise negation operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-16>Attributes: <a class=headline-hash href=#attributes-16>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::UnaryOpQuantizationAttr</td><td>Attribute for UnaryOp quantization information.</td></tr></table><h4 id=operands-44>Operands: <a class=headline-hash href=#operands-44>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-45>Results: <a class=headline-hash href=#results-45>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosapad-mlirtosapadop><code>tosa.pad</code> (mlir::tosa::PadOp) <a class=headline-hash href=#tosapad-mlirtosapadop>¶</a></h3><p><em>Pads a tensor with value specified.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.pad` operands attr-dict `:` functional-type(operands, results) </code></pre><p>The <code>tosa.pad</code> operation pads a tensor along borders of each dimension with <code>pad_const</code> (defaults to zero), given a padding configuration <code>padding</code> specifying low and high values along the dimensions.</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl><span class=nv>%0</span> <span class=p>=</span> arith<span class=p>.</span><span class=kt>constant</span> dense<span class=p><[[</span><span class=m>1</span><span class=p>,</span> <span class=m>2</span><span class=p>],</span> <span class=p>[</span><span class=m>3</span><span class=p>,</span> <span class=m>4</span><span class=p>]]></span> <span class=p>:</span> <span class=kt>tensor</span><span class=p><</span><span class=m>2x2x</span><span class=k>i32</span><span class=p>></span> </span></span><span class=line><span class=cl>tosa<span class=p>.</span>pad <span class=nv>%arg0</span><span class=p>,</span> <span class=nv>%0</span> <span class=p>:</span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>1x2x</span><span class=k>f32</span><span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>2x2x</span><span class=k>i32</span><span class=p>>)</span> <span class=p>-></span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>4x9x</span><span class=k>f32</span><span class=p>>)</span> </span></span></code></pre></div><p>Example 2:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl><span class=nv>%0</span> <span class=p>=</span> arith<span class=p>.</span><span class=kt>constant</span> dense<span class=p><[[</span><span class=m>-1</span><span class=p>,</span> <span class=m>2</span><span class=p>],</span> <span class=p>[</span><span class=m>3</span><span class=p>,</span> <span class=m>4</span><span class=p>]]></span> <span class=p>:</span> <span class=kt>tensor</span><span class=p><</span><span class=m>2x2x</span><span class=k>i32</span><span class=p>></span> </span></span><span class=line><span class=cl>tosa<span class=p>.</span>pad <span class=nv>%arg0</span><span class=p>,</span> <span class=nv>%0</span> <span class=p>:</span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>1x2x</span><span class=k>f32</span><span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>2x2x</span><span class=k>i32</span><span class=p>>)</span> <span class=p>-></span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>?x9x</span><span class=k>f32</span><span class=p>>)</span> </span></span></code></pre></div><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-17>Attributes: <a class=headline-hash href=#attributes-17>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::PadOpQuantizationAttr</td><td>Attribute for PadOp quantization information.</td></tr></table><h4 id=operands-45>Operands: <a class=headline-hash href=#operands-45>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant ranked tensor of number values</td></tr><tr><td style=text-align:center><code>padding</code></td><td>tosa-conformant tensor of 32-bit signless integer or 64-bit signless integer values</td></tr><tr><td style=text-align:center><code>pad_const</code></td><td>0D tensor of number values</td></tr></tbody></table><h4 id=results-46>Results: <a class=headline-hash href=#results-46>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant ranked tensor of number values</td></tr></tbody></table><h3 id=tosapow-mlirtosapowop><code>tosa.pow</code> (mlir::tosa::PowOp) <a class=headline-hash href=#tosapow-mlirtosapowop>¶</a></h3><p><em>Computes the power of one value to another.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.pow` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise input1 raised to the power of input2. Axis of size 1 will be broadcast, as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-46>Operands: <a class=headline-hash href=#operands-46>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-47>Results: <a class=headline-hash href=#results-47>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>z</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosarfft2d-mlirtosarfft2dop><code>tosa.rfft2d</code> (mlir::tosa::RFFT2dOp) <a class=headline-hash href=#tosarfft2d-mlirtosarfft2dop>¶</a></h3><p><em>Performs RFFT2D operation on the input.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.rfft2d` $input attr-dict `:` `(` type($input) `)` `->` `(` type($output_real) `,` type($output_imag) `)` </code></pre><p>Performs a batched 2D real-valued Fast Fourier Transform over the input where the input tensor consists of real values producing complex valued output. The complex output values will be split into the output_real and output_imag tensor arguments. RFFT2D takes advantage of Hermitian symmetry to only calculate the first half of the final output axis. Imaginary values with locations (0,0), (0,W/2), (H/2,0) and (H/2,W/2) are zero.</p><p>Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-mlir data-lang=mlir><span class=line><span class=cl> <span class=nv>%real</span><span class=p>,</span> <span class=nv>%imag</span> <span class=p>=</span> tosa<span class=p>.</span>rfft2d <span class=nv>%in</span> <span class=p>:</span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>8x16x</span><span class=k>f32</span><span class=p>>)</span> <span class=p>-></span> <span class=p>(</span><span class=kt>tensor</span><span class=p><</span><span class=m>8x9x</span><span class=k>f32</span><span class=p>>,</span> <span class=kt>tensor</span><span class=p><</span><span class=m>8x9x</span><span class=k>f32</span><span class=p>>)</span> </span></span></code></pre></div><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-18>Attributes: <a class=headline-hash href=#attributes-18>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>local_bound</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-47>Operands: <a class=headline-hash href=#operands-47>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-48>Results: <a class=headline-hash href=#results-48>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output_real</code></td><td>3-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>output_imag</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosareciprocal-mlirtosareciprocalop><code>tosa.reciprocal</code> (mlir::tosa::ReciprocalOp) <a class=headline-hash href=#tosareciprocal-mlirtosareciprocalop>¶</a></h3><p><em>Elementwise reciprocal op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reciprocal` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise reciprocal operation. For integer operation, a TABLE should be used with the appropriate ranges.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-48>Operands: <a class=headline-hash href=#operands-48>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-49>Results: <a class=headline-hash href=#results-49>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareduce_all-mlirtosareduceallop><code>tosa.reduce_all</code> (mlir::tosa::ReduceAllOp) <a class=headline-hash href=#tosareduce_all-mlirtosareduceallop>¶</a></h3><p><em>Reduce All operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reduce_all` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Reduce a tensor along the given axis with a logical AND operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-19>Attributes: <a class=headline-hash href=#attributes-19>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-49>Operands: <a class=headline-hash href=#operands-49>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-50>Results: <a class=headline-hash href=#results-50>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareduce_any-mlirtosareduceanyop><code>tosa.reduce_any</code> (mlir::tosa::ReduceAnyOp) <a class=headline-hash href=#tosareduce_any-mlirtosareduceanyop>¶</a></h3><p><em>Reduce Any operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reduce_any` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Reduce a tensor along the given axis with a logical OR operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-20>Attributes: <a class=headline-hash href=#attributes-20>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-50>Operands: <a class=headline-hash href=#operands-50>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-51>Results: <a class=headline-hash href=#results-51>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareduce_max-mlirtosareducemaxop><code>tosa.reduce_max</code> (mlir::tosa::ReduceMaxOp) <a class=headline-hash href=#tosareduce_max-mlirtosareducemaxop>¶</a></h3><p><em>Reduce Max operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reduce_max` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Reduce a tensor along the given axis with a maximum operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-21>Attributes: <a class=headline-hash href=#attributes-21>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-51>Operands: <a class=headline-hash href=#operands-51>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-52>Results: <a class=headline-hash href=#results-52>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareduce_min-mlirtosareduceminop><code>tosa.reduce_min</code> (mlir::tosa::ReduceMinOp) <a class=headline-hash href=#tosareduce_min-mlirtosareduceminop>¶</a></h3><p><em>Reduce Min operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reduce_min` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Reduce a tensor along the given axis with a minimum operation</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-22>Attributes: <a class=headline-hash href=#attributes-22>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-52>Operands: <a class=headline-hash href=#operands-52>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-53>Results: <a class=headline-hash href=#results-53>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareduce_prod-mlirtosareduceprodop><code>tosa.reduce_prod</code> (mlir::tosa::ReduceProdOp) <a class=headline-hash href=#tosareduce_prod-mlirtosareduceprodop>¶</a></h3><p><em>Reduce Prod operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reduce_prod` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Reduce a tensor along the given axis by computing the product of the axis.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-23>Attributes: <a class=headline-hash href=#attributes-23>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-53>Operands: <a class=headline-hash href=#operands-53>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-54>Results: <a class=headline-hash href=#results-54>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareduce_sum-mlirtosareducesumop><code>tosa.reduce_sum</code> (mlir::tosa::ReduceSumOp) <a class=headline-hash href=#tosareduce_sum-mlirtosareducesumop>¶</a></h3><p><em>Reduce Sum operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reduce_sum` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Reduce a tensor along the given axis by computing the sum of the axis.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-24>Attributes: <a class=headline-hash href=#attributes-24>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-54>Operands: <a class=headline-hash href=#operands-54>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-55>Results: <a class=headline-hash href=#results-55>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosarescale-mlirtosarescaleop><code>tosa.rescale</code> (mlir::tosa::RescaleOp) <a class=headline-hash href=#tosarescale-mlirtosarescaleop>¶</a></h3><p><em>Tosa rescale operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.rescale` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Rescale quantized values into a new domain. Supported rescalings are:</p><table><thead><tr><th>Mode</th><th>Input</th><th>Output</th></tr></thead><tbody><tr><td>signed 8 to 8</td><td>int8</td><td>int8</td></tr><tr><td>signed 8 to 16</td><td>int8</td><td>int16</td></tr><tr><td>signed 8 to 32</td><td>int8</td><td>int32</td></tr><tr><td>signed 16 to 8</td><td>int16</td><td>int8</td></tr><tr><td>signed 16 to 16</td><td>int16</td><td>int16</td></tr><tr><td>signed 16 to 32</td><td>int16</td><td>int32</td></tr><tr><td>signed 32 to 8</td><td>int32</td><td>int8</td></tr><tr><td>signed 32 to 16</td><td>int32</td><td>int16</td></tr><tr><td>signed 32 to 32</td><td>int32</td><td>int32</td></tr><tr><td>signed 48 to 8</td><td>int48</td><td>int8</td></tr><tr><td>signed 48 to 16</td><td>int48</td><td>int16</td></tr><tr><td>signed 48 to 32</td><td>int48</td><td>int32</td></tr><tr><td>unsigned 8 to signed 8</td><td>uint8</td><td>int8</td></tr><tr><td>signed 8 to unsigned 8</td><td>int8</td><td>uint8</td></tr></tbody></table><p>Traits: <code>AlwaysSpeculatableImplTrait</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-25>Attributes: <a class=headline-hash href=#attributes-25>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>input_zp</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr><tr><td><code>output_zp</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr><tr><td><code>multiplier</code></td><td>::mlir::DenseI32ArrayAttr</td><td>i32 dense array attribute</td></tr><tr><td><code>shift</code></td><td>::mlir::DenseI8ArrayAttr</td><td>i8 dense array attribute</td></tr><tr><td><code>scale32</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr><tr><td><code>double_round</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr><tr><td><code>per_channel</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-55>Operands: <a class=headline-hash href=#operands-55>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-56>Results: <a class=headline-hash href=#results-56>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosareshape-mlirtosareshapeop><code>tosa.reshape</code> (mlir::tosa::ReshapeOp) <a class=headline-hash href=#tosareshape-mlirtosareshapeop>¶</a></h3><p><em>Reshape operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reshape` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Returns a tensor with the same type/values as the input, with a new shape specified by the shape argument. Reshape may operate on tensors of any rank. No data conversion happens during a reshape operation.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code>, <code>InferTensorType</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>InferTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-26>Attributes: <a class=headline-hash href=#attributes-26>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>new_shape</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute</td></tr></table><h4 id=operands-56>Operands: <a class=headline-hash href=#operands-56>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-57>Results: <a class=headline-hash href=#results-57>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant ranked tensor of number values</td></tr></tbody></table><h3 id=tosaresize-mlirtosaresizeop><code>tosa.resize</code> (mlir::tosa::ResizeOp) <a class=headline-hash href=#tosaresize-mlirtosaresizeop>¶</a></h3><p><em>Resize operation, supports various resize/upsample modes</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.resize` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Resizes a tensor. Resize is only allowed in the H and W dimensions. In expected use, The height dimension is scaled by factor (scale_y_n/scale_y_d). And the width dimension is scaled by factor (scale_x_n/scale_x_d). Thus the output dimensions can be derived from the input dimensions by inverting the scale. And the [order_y, border_x] values adjust the output size to allow fractional sampling beyond integer input position (IH-1,IW-1).</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-27>Attributes: <a class=headline-hash href=#attributes-27>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>scale</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr><tr><td><code>offset</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>border</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>mode</code></td><td>::mlir::StringAttr</td><td>Supported resize/upsampling strategies</td></tr></table><h4 id=operands-57>Operands: <a class=headline-hash href=#operands-57>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-58>Results: <a class=headline-hash href=#results-58>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosareverse-mlirtosareverseop><code>tosa.reverse</code> (mlir::tosa::ReverseOp) <a class=headline-hash href=#tosareverse-mlirtosareverseop>¶</a></h3><p><em>Reverse operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.reverse` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Returns a tensor with the same type/values as the input, with the data reversed along the given axis. No data conversion happens during a reverse operation.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-28>Attributes: <a class=headline-hash href=#attributes-28>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>axis</code></td><td>::mlir::IntegerAttr</td><td>32-bit signless integer attribute</td></tr></table><h4 id=operands-58>Operands: <a class=headline-hash href=#operands-58>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-59>Results: <a class=headline-hash href=#results-59>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosarsqrt-mlirtosarsqrtop><code>tosa.rsqrt</code> (mlir::tosa::RsqrtOp) <a class=headline-hash href=#tosarsqrt-mlirtosarsqrtop>¶</a></h3><p><em>Elementwise 1/sqrt op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.rsqrt` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise reciprocal square root operation. For integer operation, a TABLE should be used with the appropriate ranges.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-59>Operands: <a class=headline-hash href=#operands-59>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-60>Results: <a class=headline-hash href=#results-60>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosascatter-mlirtosascatterop><code>tosa.scatter</code> (mlir::tosa::ScatterOp) <a class=headline-hash href=#tosascatter-mlirtosascatterop>¶</a></h3><p><em>Scatter operation,</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.scatter` operands attr-dict `:` functional-type(operands, results) </code></pre><p>The values_out tensor is set to the values_in tensor with data modified as follows: data from the input tensor is inserted at the positions specified by the indices tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-60>Operands: <a class=headline-hash href=#operands-60>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>values_in</code></td><td>3-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>indices</code></td><td>2D tensor of 32-bit signless integer values</td></tr><tr><td style=text-align:center><code>input</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-61>Results: <a class=headline-hash href=#results-61>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>values_out</code></td><td>3-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosaselect-mlirtosaselectop><code>tosa.select</code> (mlir::tosa::SelectOp) <a class=headline-hash href=#tosaselect-mlirtosaselectop>¶</a></h3><p><em>Elementwise select operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.select` operands attr-dict `:` `(` type($pred) `,` type($on_true) `,` type($on_false) `)` `->` type($output) </code></pre><p>Elementwise select of the output based on a condition.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-61>Operands: <a class=headline-hash href=#operands-61>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>pred</code></td><td>tosa-conformant tensor of 1-bit signless integer values</td></tr><tr><td style=text-align:center><code>on_true</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>on_false</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-62>Results: <a class=headline-hash href=#results-62>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosasigmoid-mlirtosasigmoidop><code>tosa.sigmoid</code> (mlir::tosa::SigmoidOp) <a class=headline-hash href=#tosasigmoid-mlirtosasigmoidop>¶</a></h3><p><em>Computes elementwise sigmoid of input.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.sigmoid` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Sigmoid function: output = 1 / (1 + exp(-input)) For quantized integer data types, the TABLE operator should be used instead with the following definition. The sigmoid table has 513 entries each of 16-bit precision and covering the input range -16.0 to +16.0 in steps of 1/16.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-62>Operands: <a class=headline-hash href=#operands-62>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-63>Results: <a class=headline-hash href=#results-63>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosasin-mlirtosasinop><code>tosa.sin</code> (mlir::tosa::SinOp) <a class=headline-hash href=#tosasin-mlirtosasinop>¶</a></h3><p><em>Elementwise sin op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.sin` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise sine operation for values given in radians.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-63>Operands: <a class=headline-hash href=#operands-63>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of floating-point values</td></tr></tbody></table><h4 id=results-64>Results: <a class=headline-hash href=#results-64>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of floating-point values</td></tr></tbody></table><h3 id=tosaslice-mlirtosasliceop><code>tosa.slice</code> (mlir::tosa::SliceOp) <a class=headline-hash href=#tosaslice-mlirtosasliceop>¶</a></h3><p><em>Slice operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.slice` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Extracts a slice of the input1 on the given axis, beginning at the start coordinates, and extending for size elements in each direction. No data conversion happens during a slice operation.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-29>Attributes: <a class=headline-hash href=#attributes-29>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>start</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute</td></tr><tr><td><code>size</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute</td></tr></table><h4 id=operands-64>Operands: <a class=headline-hash href=#operands-64>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-65>Results: <a class=headline-hash href=#results-65>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosasub-mlirtosasubop><code>tosa.sub</code> (mlir::tosa::SubOp) <a class=headline-hash href=#tosasub-mlirtosasubop>¶</a></h3><p><em>Elementwise subtraction operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.sub` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Elementwise subtraction of input1 and input2. Axis of size 1 will be broadcast as necessary.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-65>Operands: <a class=headline-hash href=#operands-65>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>input2</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-66>Results: <a class=headline-hash href=#results-66>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosatable-mlirtosatableop><code>tosa.table</code> (mlir::tosa::TableOp) <a class=headline-hash href=#tosatable-mlirtosatableop>¶</a></h3><p><em>Table lookup op</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.table` $input1 `,` $table attr-dict `:` `(` type($input1) `,` type($table) `)` `->` type($output) </code></pre><p>Interpolated table lookup operation. Input values are scaled to create a fixed-point 9.7 value. The high 9 bits are used to index into the table. The fractional bits are used to interpolate based on the looked up value and the index+1 value in the table. The TABLE operator then returns a 16.7 interpolated value. Note that there must be 513 values to handle the full range of inputs.</p><p>The TABLE operator is expected to be used as follows:</p><ul><li>A RESCALE node is expected before the TABLE operator to scale the input to a full int16_t range for the table lookup</li><li>If an int16_t result is required then follow the TABLE operator with a RESCALE with a right shift of 7</li><li>If an int8_t result is required then follow the TABLE operator with a RESCALE with a right shift of 15</li></ul><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-66>Operands: <a class=headline-hash href=#operands-66>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>table</code></td><td>1-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-67>Results: <a class=headline-hash href=#results-67>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosatanh-mlirtosatanhop><code>tosa.tanh</code> (mlir::tosa::TanhOp) <a class=headline-hash href=#tosatanh-mlirtosatanhop>¶</a></h3><p><em>Computes elementwise hyperbolic tangent of input</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.tanh` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Parameterized hyperbolic tangent. For quantized integer data types, the TABLE operator should be used instead with the following definition. The tanh_table has 513 entries each of 16-bit precision and covering the input range -8.0 to +8.0 in steps of 1/32.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>ResultsBroadcastableShape</code>, <code>SameOperandsAndResultElementType</code>, <code>SameOperandsAndResultShape</code>, <code>TosaElementwiseOperator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-67>Operands: <a class=headline-hash href=#operands-67>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-68>Results: <a class=headline-hash href=#results-68>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosatile-mlirtosatileop><code>tosa.tile</code> (mlir::tosa::TileOp) <a class=headline-hash href=#tosatile-mlirtosatileop>¶</a></h3><p><em>Tile operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.tile` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Replicates input 0 multiplies times along each dimension.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-30>Attributes: <a class=headline-hash href=#attributes-30>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>multiples</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute</td></tr></table><h4 id=operands-68>Operands: <a class=headline-hash href=#operands-68>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-69>Results: <a class=headline-hash href=#results-69>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosatranspose_conv2d-mlirtosatransposeconv2dop><code>tosa.transpose_conv2d</code> (mlir::tosa::TransposeConv2DOp) <a class=headline-hash href=#tosatranspose_conv2d-mlirtosatransposeconv2dop>¶</a></h3><p><em>Transpose 2D Convolution operator.</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.transpose_conv2d` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Performs a 2D transposed convolution over the given tensor input, using the weights tensor.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=attributes-31>Attributes: <a class=headline-hash href=#attributes-31>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>out_pad</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr><tr><td><code>stride</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 2 elements</td></tr><tr><td><code>out_shape</code></td><td>::mlir::DenseI64ArrayAttr</td><td>i64 dense array attribute with exactly 4 elements</td></tr><tr><td><code>quantization_info</code></td><td>mlir::tosa::ConvOpQuantizationAttr</td><td>Attribute for Conv type op quantization information.</td></tr><tr><td><code>local_bound</code></td><td>::mlir::BoolAttr</td><td>bool attribute</td></tr></table><h4 id=operands-69>Operands: <a class=headline-hash href=#operands-69>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input</code></td><td>4-d tosa-conformant tensor</td></tr><tr><td style=text-align:center><code>filter</code></td><td>4D tensor of 4-bit signless integer or 8-bit signless integer or Quint8 type or Qint4 type or Qint8 type or Qint16 type or Qint32 type or floating-point values</td></tr><tr><td style=text-align:center><code>bias</code></td><td>1-d tosa-conformant tensor</td></tr></tbody></table><h4 id=results-70>Results: <a class=headline-hash href=#results-70>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>4-d tosa-conformant tensor</td></tr></tbody></table><h3 id=tosatranspose-mlirtosatransposeop><code>tosa.transpose</code> (mlir::tosa::TransposeOp) <a class=headline-hash href=#tosatranspose-mlirtosatransposeop>¶</a></h3><p><em>Transpose operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.transpose` operands attr-dict `:` functional-type(operands, results) </code></pre><p>Permutes the dimensions based on perm.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>InferShapedTypeOpAdaptor</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>InferShapedTypeOpInterface</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>ReifyRankedShapedTypeOpInterface</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-70>Operands: <a class=headline-hash href=#operands-70>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>input1</code></td><td>tosa-conformant tensor of number values</td></tr><tr><td style=text-align:center><code>perms</code></td><td>tosa-conformant tensor of 32-bit signless integer values</td></tr></tbody></table><h4 id=results-71>Results: <a class=headline-hash href=#results-71>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosavariable-mlirtosavariableop><code>tosa.variable</code> (mlir::tosa::VariableOp) <a class=headline-hash href=#tosavariable-mlirtosavariableop>¶</a></h3><p><em>Defines a variable</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.variable` $name attr-dict custom<TypeOrAttr>($type, $initial_value) </code></pre><p>Defines a new TOSA variable. This is a mutable value. Modifications are expressed using read/write semantics.</p><p>Interfaces: <code>TosaOpInterface</code></p><h4 id=attributes-32>Attributes: <a class=headline-hash href=#attributes-32>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>name</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr><tr><td><code>type</code></td><td>::mlir::TypeAttr</td><td>any type attribute</td></tr><tr><td><code>initial_value</code></td><td>::mlir::Attribute</td><td>any attribute</td></tr></table><h3 id=tosavariableread-mlirtosavariablereadop><code>tosa.variable.read</code> (mlir::tosa::VariableReadOp) <a class=headline-hash href=#tosavariableread-mlirtosavariablereadop>¶</a></h3><p><em>Read_buffer operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.variable.read` $name attr-dict `:` type($value) </code></pre><p>Reads the value from a pseudo-buffer resource holding a mutable tensor.</p><p>Interfaces: <code>TosaOpInterface</code></p><h4 id=attributes-33>Attributes: <a class=headline-hash href=#attributes-33>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>name</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr></table><h4 id=results-72>Results: <a class=headline-hash href=#results-72>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>value</code></td><td>any type</td></tr></tbody></table><h3 id=tosavariablewrite-mlirtosavariablewriteop><code>tosa.variable.write</code> (mlir::tosa::VariableWriteOp) <a class=headline-hash href=#tosavariablewrite-mlirtosavariablewriteop>¶</a></h3><p><em>Write_buffer operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.variable.write` $name attr-dict `,` $value `:` type($value) </code></pre><p>Assigns a value to pseudo-buffer resource holding a mutable tensor.</p><p>Interfaces: <code>TosaOpInterface</code></p><h4 id=attributes-34>Attributes: <a class=headline-hash href=#attributes-34>¶</a></h4><table><tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr><tr><td><code>name</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr></table><h4 id=operands-71>Operands: <a class=headline-hash href=#operands-71>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>value</code></td><td>any type</td></tr></tbody></table><h3 id=tosawhile_loop-mlirtosawhileop><code>tosa.while_loop</code> (mlir::tosa::WhileOp) <a class=headline-hash href=#tosawhile_loop-mlirtosawhileop>¶</a></h3><p><em>Output = input; While (Cond(output)) {output = Body(output)}</em></p><p>Generates and evaluates a Bool condition and either executes a loop body or exits to another control point. This action is performed repeatedly after updating and re-evaluating the Boolean condition every iteration. This implements the semantic foreach or while iterative loop structure.</p><p>Traits: <code>InferShapedTypeOpAdaptor</code>, <code>RecursiveMemoryEffects</code>, <code>SingleBlockImplicitTerminator<YieldOp></code>, <code>SingleBlock</code></p><p>Interfaces: <code>InferShapedTypeOpInterface</code>, <code>LoopLikeOpInterface</code>, <code>TosaOpInterface</code></p><h4 id=operands-72>Operands: <a class=headline-hash href=#operands-72>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>inputs</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h4 id=results-73>Results: <a class=headline-hash href=#results-73>¶</a></h4><table><thead><tr><th style=text-align:center>Result</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>output</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><h3 id=tosayield-mlirtosayieldop><code>tosa.yield</code> (mlir::tosa::YieldOp) <a class=headline-hash href=#tosayield-mlirtosayieldop>¶</a></h3><p><em>Yield operator</em></p><p>Syntax:</p><pre tabindex=0><code>operation ::= `tosa.yield` $inputs attr-dict `:` type($inputs) </code></pre><p>return operation within the conditional and body of structured control flow. Operation takes variadic operands but produces no results of its own.</p><p>Traits: <code>AlwaysSpeculatableImplTrait</code>, <code>Terminator</code></p><p>Interfaces: <code>ConditionallySpeculatable</code>, <code>NoMemoryEffect (MemoryEffectOpInterface)</code>, <code>TosaOpInterface</code></p><p>Effects: <code>MemoryEffects::Effect{}</code></p><h4 id=operands-73>Operands: <a class=headline-hash href=#operands-73>¶</a></h4><table><thead><tr><th style=text-align:center>Operand</th><th>Description</th></tr></thead><tbody><tr><td style=text-align:center><code>inputs</code></td><td>variadic of tosa-conformant tensor of number values</td></tr></tbody></table><div class=edit-meta><br></div><nav class=pagination><a class="nav nav-prev" href=https://mlir.llvm.org/docs/Dialects/SPIR-V/ title="SPIR-V Dialect"><i class="fas fa-arrow-left" aria-hidden=true></i> Prev - SPIR-V Dialect</a> <a class="nav nav-next" href=https://mlir.llvm.org/docs/Dialects/Transform/ title="Transform Dialect">Next - Transform Dialect <i class="fas fa-arrow-right" aria-hidden=true></i></a></nav><footer><p class=powered>Powered by <a href=https://gohugo.io>Hugo</a>. Theme by <a href=https://themes.gohugo.io/hugo-theme-techdoc/>TechDoc</a>. Designed by <a href=https://github.com/thingsym/hugo-theme-techdoc>Thingsym</a>.</p></footer></main><div class=sidebar><nav class=slide-menu><ul><li><a href=https://mlir.llvm.org/>Home</a></li><li><a href=https://mlir.llvm.org/users/>Users of MLIR</a></li><li><a href=https://mlir.llvm.org/pubs/>MLIR Related Publications</a></li><li><a href=https://mlir.llvm.org/talks/>Talks</a></li><li><a href=https://mlir.llvm.org/deprecation/>Deprecations & Current Refactoring</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/getting_started/>Getting Started<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/getting_started/ReportingIssues/>Reporting Issues</a></li><li><a href=https://mlir.llvm.org/getting_started/Debugging/>Debugging Tips</a></li><li><a href=https://mlir.llvm.org/getting_started/Faq/>FAQ</a></li><li><a href=https://mlir.llvm.org/getting_started/Contributing/>How to Contribute</a></li><li><a href=https://mlir.llvm.org/getting_started/DeveloperGuide/>Developer Guide</a></li><li><a href=https://mlir.llvm.org/getting_started/openprojects/>Open Projects</a></li><li><a href=https://mlir.llvm.org/getting_started/Glossary/>Glossary</a></li><li><a href=https://mlir.llvm.org/getting_started/TestingGuide/>Testing Guide</a></li></ul></li><li class="parent has-sub-menu"><a href=https://mlir.llvm.org/docs/>Code Documentation<span class="mark opened">-</span></a><ul class=sub-menu><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Bindings/>Bindings<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Bindings/Python/>MLIR Python Bindings</a></li></ul></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Tools/>Tools<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Tools/MLIRLSP/>MLIR : Language Server Protocol</a></li><li><a href=https://mlir.llvm.org/docs/Tools/mlir-reduce/>MLIR Reduce</a></li><li><a href=https://mlir.llvm.org/docs/Tools/mlir-rewrite/>mlir-rewrite</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/QuantPasses/></a></li><li><a href=https://mlir.llvm.org/docs/ActionTracing/>Action: Tracing and Debugging MLIR-based Compilers</a></li><li><a href=https://mlir.llvm.org/docs/BufferDeallocationInternals/>Buffer Deallocation - Internals</a></li><li><a href=https://mlir.llvm.org/docs/Bufferization/>Bufferization</a></li><li><a href=https://mlir.llvm.org/docs/DataLayout/>Data Layout Modeling</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/DefiningDialects/>Defining Dialects<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/DefiningDialects/Constraints/>Constraints</a></li><li><a href=https://mlir.llvm.org/docs/DefiningDialects/AttributesAndTypes/>Defining Dialect Attributes and Types</a></li><li><a href=https://mlir.llvm.org/docs/DefiningDialects/Operations/>Operation Definition Specification (ODS)</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/Diagnostics/>Diagnostic Infrastructure</a></li><li><a href=https://mlir.llvm.org/docs/DialectConversion/>Dialect Conversion</a></li><li class="parent has-sub-menu"><a href=https://mlir.llvm.org/docs/Dialects/>Dialects<span class="mark opened">-</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Dialects/DLTITransformOps/></a></li><li><a href=https://mlir.llvm.org/docs/Dialects/OpenACCDialect/>'acc' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/Affine/>'affine' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/AMDGPU/>'amdgpu' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/AMX/>'amx' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ArithOps/>'arith' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ArmNeon/>'arm_neon' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ArmSVE/>'arm_sve' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ArmSME/>'ArmSME' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/AsyncDialect/>'async' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/BufferizationOps/>'bufferization' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ControlFlowDialect/>'cf' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ComplexOps/>'complex' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/DLTIDialect/>'dlti' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/EmitC/>'emitc' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/Func/>'func' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/GPU/>'gpu' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/IndexOps/>'index' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/IRDL/>'irdl' Dialect</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Dialects/Linalg/>'linalg' Dialect<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Dialects/Linalg/OpDSL/>Linalg OpDSL</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/Dialects/LLVM/>'llvm' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/MathOps/>'math' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/MemRef/>'memref' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/Mesh/>'mesh' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/MLProgramOps/>'ml_program' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/MPI/>'mpi' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/NVGPU/>'nvgpu' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/NVVMDialect/>'nvvm' Dialect</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Dialects/OpenMPDialect/>'omp' Dialect<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Dialects/OpenMPDialect/ODS/>ODS Documentation</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/Dialects/PDLInterpOps/>'pdl_interp' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/PDLOps/>'pdl' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/PolynomialDialect/>'polynomial' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/PtrOps/>'ptr' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/QuantDialect/>'quant' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ROCDLDialect/>'rocdl' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/SCFDialect/>'scf' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/ShapeDialect/>'shape' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/SparseTensorOps/>'sparse_tensor' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/TensorOps/>'tensor' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/UBOps/>'ub' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/VCIXDialect/>'vcix' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/Vector/>'vector' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/X86Vector/>'x86vector' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/XeGPU/>'xegpu' Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/Builtin/>Builtin Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/MatchOpInterfaces/>OpInterface definitions</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/SPIR-V/>SPIR-V Dialect</a></li><li class=active><a href=https://mlir.llvm.org/docs/Dialects/TOSA/>Tensor Operator Set Architecture (TOSA) Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Dialects/Transform/>Transform Dialect</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/Interfaces/>Interfaces</a></li><li><a href=https://mlir.llvm.org/docs/TargetLLVMIR/>LLVM IR Target</a></li><li><a href=https://mlir.llvm.org/docs/BytecodeFormat/>MLIR Bytecode Format</a></li><li><a href=https://mlir.llvm.org/docs/CAPI/>MLIR C API</a></li><li><a href=https://mlir.llvm.org/docs/LangRef/>MLIR Language Reference</a></li><li><a href=https://mlir.llvm.org/docs/ReleaseNotes/>MLIR Release Notes</a></li><li><a href=https://mlir.llvm.org/docs/Canonicalization/>Operation Canonicalization</a></li><li><a href=https://mlir.llvm.org/docs/OwnershipBasedBufferDeallocation/>Ownership-based Buffer Deallocation</a></li><li><a href=https://mlir.llvm.org/docs/PassManagement/>Pass Infrastructure</a></li><li><a href=https://mlir.llvm.org/docs/Passes/>Passes</a></li><li><a href=https://mlir.llvm.org/docs/PatternRewriter/>Pattern Rewriting : Generic DAG-to-DAG Rewriting</a></li><li><a href=https://mlir.llvm.org/docs/PDLL/>PDLL - PDL Language</a></li><li><a href=https://mlir.llvm.org/docs/Quantization/>Quantization</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Rationale/>Rationale<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Rationale/RationaleGenericDAGRewriter/>Generic DAG Rewriter Infrastructure Rationale</a></li><li><a href=https://mlir.llvm.org/docs/Rationale/RationaleLinalgDialect/>Linalg Dialect Rationale: The Case For Compiler-Friendly Custom Operations</a></li><li><a href=https://mlir.llvm.org/docs/Rationale/Rationale/>MLIR Rationale</a></li><li><a href=https://mlir.llvm.org/docs/Rationale/MLIRForGraphAlgorithms/>MLIR: Incremental Application to Graph Algorithms in ML Frameworks</a></li><li><a href=https://mlir.llvm.org/docs/Rationale/RationaleSimplifiedPolyhedralForm/>MLIR: The case for a simplified polyhedral form</a></li><li><a href=https://mlir.llvm.org/docs/Rationale/SideEffectsAndSpeculation/>Side Effects & Speculation</a></li><li><a href=https://mlir.llvm.org/docs/Rationale/UsageOfConst/>Usage of 'const' in MLIR, for core IR types</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/ShapeInference/>Shape Inference</a></li><li><a href=https://mlir.llvm.org/docs/SPIRVToLLVMDialectConversion/>SPIR-V Dialect to LLVM Dialect conversion manual</a></li><li><a href=https://mlir.llvm.org/docs/SymbolsAndSymbolTables/>Symbols and Symbol Tables</a></li><li><a href=https://mlir.llvm.org/docs/DeclarativeRewrites/>Table-driven Declarative Rewrite Rule (DRR)</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Traits/>Traits<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Traits/Broadcastable/>The `Broadcastable` Trait</a></li></ul></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Tutorials/>Tutorials<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Tutorials/CreatingADialect/>Creating a Dialect</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/QuickstartRewrites/>Quickstart tutorial to adding MLIR graph rewrite</a></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Tutorials/Toy/>Toy Tutorial<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-1/>Chapter 1: Toy Language and AST</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-2/>Chapter 2: Emitting Basic MLIR</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-3/>Chapter 3: High-level Language-Specific Analysis and Transformation</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-4/>Chapter 4: Enabling Generic Transformation with Interfaces</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-5/>Chapter 5: Partial Lowering to Lower-Level Dialects for Optimization</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-6/>Chapter 6: Lowering to LLVM and CodeGeneration</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/Toy/Ch-7/>Chapter 7: Adding a Composite Type to Toy</a></li></ul></li><li class=has-sub-menu><a href=https://mlir.llvm.org/docs/Tutorials/transform/>Transform Dialect Tutorial<span class="mark closed">+</span></a><ul class=sub-menu><li><a href=https://mlir.llvm.org/docs/Tutorials/transform/Ch0/>Chapter 0: A Primer on “Structured” Linalg Operations</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/transform/Ch1/>Chapter 1: Combining Existing Transformations</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/transform/Ch2/>Chapter 2: Adding a Simple New Transformation Operation</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/transform/Ch3/>Chapter 3: More than Simple Transform Operations</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/transform/Ch4/>Chapter 4: Matching Payload with Transform Operations</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/transform/ChH/>Chapter H: Reproducing Halide Schedule</a></li></ul></li><li><a href=https://mlir.llvm.org/docs/Tutorials/UnderstandingTheIRStructure/>Understanding the IR Structure</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/MlirOpt/>Using `mlir-opt`</a></li><li><a href=https://mlir.llvm.org/docs/Tutorials/DataFlowAnalysis/>Writing DataFlow Analyses in MLIR</a></li></ul></li></ul></li></ul></nav><div class=sidebar-footer></div></div></div><a href=# id=backtothetop-fixed class=backtothetop data-backtothetop-duration=600 data-backtothetop-easing=easeOutQuart data-backtothetop-fixed-fadein=1000 data-backtothetop-fixed-fadeout=1000 data-backtothetop-fixed-bottom=10 data-backtothetop-fixed-right=20><span class="fa-layers fa-fw"><i class="fas fa-circle"></i> <i class="fas fa-arrow-circle-up"></i></span></a></div></body></html>