mlir.dialects.tosa

Classes

AbsOp

Elementwise absolute value operation.

AbsOpAdaptor

AddOp

Elementwise addition of input1 and input2. Axis of size 1 will be broadcast,

AddOpAdaptor

AddShapeOp

Elementwise addition of input1 and input2. Size of shapes must match.

AddShapeOpAdaptor

ApplyScaleOp

Applies rescaling for fixed point values. This behavior is replicated in

ApplyScaleOpAdaptor

ArgMaxOp

This returns the index with the largest value across the given axis of the

ArgMaxOpAdaptor

ArithmeticRightShiftOp

Elementwise arithmetic right shift of input1 by the amount specified in

ArithmeticRightShiftOpAdaptor

AssertEqualShapeOp

Verify input1 and input2 are equal. If allow_broadcast is set, shapes which

AssertEqualShapeOpAdaptor

AvgPool2dOp

This performs an average pooling over the given input tensor. A sliding

AvgPool2dOpAdaptor

BitwiseAndOp

Elementwise bitwise AND of input1 and input2. Axis of size 1

BitwiseAndOpAdaptor

BitwiseNotOp

Elementwise bitwise NOT of input tensor.

BitwiseNotOpAdaptor

BitwiseOrOp

Elementwise bitwise OR of input1 and input2. Axis of size 1 will be

BitwiseOrOpAdaptor

BitwiseXorOp

Elementwise bitwise XOR of input1 and input2. Axis of size 1 will be

BitwiseXorOpAdaptor

CastFromBlockScaledOp

Apply the scales from a scale tensor to the values in a value tensor, casting

CastFromBlockScaledOpAdaptor

CastOp

Casts a tensor from one data type to another.

CastOpAdaptor

CastToBlockScaledOp

Calculate a scale value per block of input values and use that to calculate

CastToBlockScaledOpAdaptor

CeilOp

Elementwise ceiling operation.

CeilOpAdaptor

ClampOp

Clamp to an arbitrary minimum and maximum value.

ClampOpAdaptor

ClzOp

Elementwise count leading zeros operation.

ClzOpAdaptor

ConcatOp

Concatenate a list of tensors along a given axis.

ConcatOpAdaptor

ConcatShapeOp

Concatenates a list of shapes into a new shape with length equal to the sum

ConcatShapeOpAdaptor

ConstOp

A node containing constant data for use as the input to an operation. May

ConstOpAdaptor

ConstShapeOp

A node containing a constant shape.

ConstShapeOpAdaptor

Conv2DBlockScaledOp

Performs a 2D convolution over the given input data and scales, using

Conv2DBlockScaledOpAdaptor

Conv2DOp

Performs a 2D convolution over the given tensor input, using the weight

Conv2DOpAdaptor

Conv3DOp

Performs a 3D convolution over the given input tensor. Implementations

Conv3DOpAdaptor

CosOp

Elementwise cosine operation for values given in radians.

CosOpAdaptor

CustomOp

Hardware implementing TOSA may choose to add additional custom operators

CustomOpAdaptor

DepthwiseConv2DOp

Performs 2D convolutions separately over each channel of the given tensor

DepthwiseConv2DOpAdaptor

DimOp

Returns a length 1 shape_t of the size of the input tensor for the given axis.

DimOpAdaptor

DivCeilShapeOp

Elementwise divide of input1 by input2. The result of the divide is rounded up.

DivCeilShapeOpAdaptor

DivFloorShapeOp

Elementwise integer divide of input1 by input2. The result of the divide is rounded down.

DivFloorShapeOpAdaptor

EqualOp

Elementwise comparison operation.

EqualOpAdaptor

ErfOp

Gauss error function: $ erf(x) = frac{2}{sqrt{pi}} int_{0}^{x} e^{-t^2} dt $

ErfOpAdaptor

Exp2ShapeOp

Computation of raising two to the power of each element in input.

Exp2ShapeOpAdaptor

ExpOp

Elementwise e to the x operation

ExpOpAdaptor

FFT2dOp

Performs a batched complex 2D Fast Fourier Transform over the input. The

FFT2dOpAdaptor

FloorOp

Elementwise floor operation.

FloorOpAdaptor

GatherOp

Generate a tensor for which each element in the output is a subtensor of the

GatherOpAdaptor

GreaterEqualOp

Elementwise comparison operation.

GreaterEqualOpAdaptor

GreaterOp

Elementwise greater than comparison operation.

GreaterOpAdaptor

IdentityOp

Returns a tensor with the same shape, type, and contents as the input.

IdentityOpAdaptor

IfOp

Evaluates a Boolean condition and then takes one of two distinct execution

IfOpAdaptor

IntDivOp

Elementwise integer divide of input1 by input2. Axis of size 1 will be

IntDivOpAdaptor

Log2CeilShapeOp

Computation of the base two logarithm of each element in input. Result is rounded up.

Log2CeilShapeOpAdaptor

Log2FloorShapeOp

Computation of the base two logarithm of each element in input. Result is rounded down.

Log2FloorShapeOpAdaptor

LogOp

Elementwise natural logarithm operation

LogOpAdaptor

LogicalAndOp

Elementwise logical AND of input1 and input2. Axis of size 1 will be

LogicalAndOpAdaptor

LogicalLeftShiftOp

Elementwise logical left-shift of input1 by the amount specified in input2.

LogicalLeftShiftOpAdaptor

LogicalNotOp

Elementwise logical NOT of input.

LogicalNotOpAdaptor

LogicalOrOp

Elementwise logical OR of input1 and input2. Axis of size 1 will be

LogicalOrOpAdaptor

LogicalRightShiftOp

Elementwise logical right shift of input1 by the amount specified in input2.

LogicalRightShiftOpAdaptor

LogicalXorOp

Elementwise logical XOR of input1 and input2. Axis of size 1 will be

LogicalXorOpAdaptor

MatMulOp

Performs two dimensional matrix multiplications.

MatMulOpAdaptor

MatmulTBlockScaledOp

Performs two dimensional matrix multiplications using block scaled tensors. The block

MatmulTBlockScaledOpAdaptor

MaxPool2dOp

This performs a max pooling over the given input tensor. A sliding window of

MaxPool2dOpAdaptor

MaxShapeOp

Elementwise maximum of input1 and input2.

MaxShapeOpAdaptor

MaximumOp

Elementwise max of input1 and input2. Axis of size 1 will be broadcast, as

MaximumOpAdaptor

MinShapeOp

Elementwise minimum of input1 and input2.

MinShapeOpAdaptor

MinimumOp

Elementwise minimum of input1 and input2. Axis of size 1

MinimumOpAdaptor

ModShapeOp

Elementwise modulo of input1 divided by input2.

ModShapeOpAdaptor

MulOp

Elementwise multiplication (Hadamard product) of input1 and input2.

MulOpAdaptor

MulShapeOp

Elementwise multiplication of input1 and input2.

MulShapeOpAdaptor

NegateOp

Elementwise negation operation.

NegateOpAdaptor

PadOp

Pads a tensor along the borders of each dimension with a supplied value.

PadOpAdaptor

PowOp

Elementwise input1 value raised to the power of input2.

PowOpAdaptor

RFFT2dOp

Performs a batched 2D real-valued Fast Fourier Transform over the input where

RFFT2dOpAdaptor

ReciprocalOp

Elementwise reciprocal operation. For integer operation, a TABLE should be

ReciprocalOpAdaptor

ReduceAllOp

Reduce a tensor along the given axis with a logical AND operation.

ReduceAllOpAdaptor

ReduceAnyOp

Reduce a tensor along the given axis with a logical OR operation.

ReduceAnyOpAdaptor

ReduceMaxOp

Reduce a tensor along the given axis with a maximum operation.

ReduceMaxOpAdaptor

ReduceMinOp

Reduce a tensor along the given axis with a minimum operation.

ReduceMinOpAdaptor

ReduceProductOp

Reduce a tensor along the given axis by computing the product of the axis.

ReduceProductOpAdaptor

ReduceSumOp

Reduce a tensor along the given axis by computing the sum of the axis.

ReduceSumOpAdaptor

RescaleOp

RESCALE is defined using an integer multiply, add, and shift.

RescaleOpAdaptor

ReshapeOp

Returns a tensor with the same type/values as the input, with a new shape

ReshapeOpAdaptor

ResizeOp

Resizes a tensor. Resize is only allowed in the H and W dimensions.

ResizeOpAdaptor

ReverseOp

Returns a tensor with the same type/values as the input, with the data

ReverseOpAdaptor

RsqrtOp

Elementwise reciprocal square root operation. For integer operation, a TABLE

RsqrtOpAdaptor

ScatterOp

The values_out tensor is set to the values_in tensor with data modified as

ScatterOpAdaptor

SelectOp

Elementwise select of the output based on a condition.

SelectOpAdaptor

SigmoidOp

Applies the sigmoid logistic function to each element of the input tensor:

SigmoidOpAdaptor

SinOp

Elementwise sine operation for values given in radians.

SinOpAdaptor

SliceOp

Extracts a slice of input1, beginning at the start coordinates,

SliceOpAdaptor

SliceShapeOp

Extract a shape of size from input.

SliceShapeOpAdaptor

SubOp

Elementwise subtraction of input1 and input2. Axis of size 1 will be

SubOpAdaptor

SubShapeOp

Elementwise subtraction of input1 and input2. Size of shapes must match.

SubShapeOpAdaptor

TableOp

Table lookup operation. For int8_t TABLE operation, perform a 256 entry

TableOpAdaptor

TanhOp

Parameterized hyperbolic tangent: $ tanh(x) = frac{1 - e^{-2x}}{1 + e^{-2x}} $.

TanhOpAdaptor

TileOp

Replicates input1 multiples times along each dimension.

TileOpAdaptor

TransposeConv2DOp

Performs a 2D transposed convolution over the given tensor input, using the

TransposeConv2DOpAdaptor

TransposeOp

Permutes the dimensions of the input tensor input1 based on the perms

TransposeOpAdaptor

VariableOp

Defines a new TOSA variable. This is a persistent mutable value across multiple

VariableOpAdaptor

VariableReadOp

Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.

VariableReadOpAdaptor

VariableWriteOp

Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.

VariableWriteOpAdaptor

WhileOp

Generates and evaluates a Boolean condition and either executes a loop body

WhileOpAdaptor

YieldOp

return operation within the conditional and body of

YieldOpAdaptor

Functions

abs(→ _ods_ir)

add(→ _ods_ir)

add_shape(→ _ods_ir)

apply_scale(→ _ods_ir)

argmax(→ _ods_ir)

arithmetic_right_shift(→ _ods_ir)

assert_equal_shape(→ AssertEqualShapeOp)

avg_pool2d(→ _ods_ir)

bitwise_and(→ _ods_ir)

bitwise_not(→ _ods_ir)

bitwise_or(→ _ods_ir)

bitwise_xor(→ _ods_ir)

cast_from_block_scaled(→ _ods_ir)

cast(→ _ods_ir)

cast_to_block_scaled(→ _ods_ir)

ceil(→ _ods_ir)

clamp(→ _ods_ir)

clz(→ _ods_ir)

concat(→ _ods_ir)

concat_shape(→ _ods_ir)

const(→ _ods_ir)

const_shape(→ _ods_ir)

conv2d_block_scaled(→ _ods_ir)

conv2d(→ _ods_ir)

conv3d(→ _ods_ir)

cos(→ _ods_ir)

custom(→ Union[_ods_ir, _ods_ir, CustomOp])

depthwise_conv2d(→ _ods_ir)

dim(→ _ods_ir)

div_ceil_shape(→ _ods_ir)

div_floor_shape(→ _ods_ir)

equal(→ _ods_ir)

erf(→ _ods_ir)

exp2_shape(→ _ods_ir)

exp(→ _ods_ir)

fft2d(→ _ods_ir)

floor(→ _ods_ir)

gather(→ _ods_ir)

greater_equal(→ _ods_ir)

greater(→ _ods_ir)

identity(→ _ods_ir)

cond_if(→ Union[_ods_ir, _ods_ir, IfOp])

intdiv(→ _ods_ir)

log2_ceil_shape(→ _ods_ir)

log2_floor_shape(→ _ods_ir)

log(→ _ods_ir)

logical_and(→ _ods_ir)

logical_left_shift(→ _ods_ir)

logical_not(→ _ods_ir)

logical_or(→ _ods_ir)

logical_right_shift(→ _ods_ir)

logical_xor(→ _ods_ir)

matmul(→ _ods_ir)

matmul_t_block_scaled(→ _ods_ir)

max_pool2d(→ _ods_ir)

max_shape(→ _ods_ir)

maximum(→ _ods_ir)

min_shape(→ _ods_ir)

minimum(→ _ods_ir)

mod_shape(→ _ods_ir)

mul(→ _ods_ir)

mul_shape(→ _ods_ir)

negate(→ _ods_ir)

pad(→ _ods_ir)

pow(→ _ods_ir)

rfft2d(→ _ods_ir)

reciprocal(→ _ods_ir)

reduce_all(→ _ods_ir)

reduce_any(→ _ods_ir)

reduce_max(→ _ods_ir)

reduce_min(→ _ods_ir)

reduce_product(→ _ods_ir)

reduce_sum(→ _ods_ir)

rescale(→ _ods_ir)

reshape(→ _ods_ir)

resize(→ _ods_ir)

reverse(→ _ods_ir)

rsqrt(→ _ods_ir)

scatter(→ _ods_ir)

select(→ _ods_ir)

sigmoid(→ _ods_ir)

sin(→ _ods_ir)

slice(→ _ods_ir)

slice_shape(→ _ods_ir)

sub(→ _ods_ir)

sub_shape(→ _ods_ir)

table(→ _ods_ir)

tanh(→ _ods_ir)

tile(→ _ods_ir)

transpose_conv2d(→ _ods_ir)

transpose(→ _ods_ir)

variable(→ VariableOp)

variable_read(→ _ods_ir)

variable_write(→ VariableWriteOp)

while_loop(→ Union[_ods_ir, _ods_ir, WhileOp])

yield_(→ YieldOp)

Module Contents

class mlir.dialects.tosa.AbsOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise absolute value operation.

Example:

%output = tosa.abs(%input1) : (tensor<21x3xf32>) -> tensor<21x3xf32>
OPERATION_NAME = 'tosa.abs'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.AbsOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.AbsOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.abs'
input1() _ods_ir
mlir.dialects.tosa.abs(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.AddOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise addition of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

Example:

// Elementwise addition.
%out = tosa.add %input1, %input2 : tensor<12x6xf32>, tensor<12x6xf32> -> tensor<12x6xf32>

// Elementwise addition with broadcasting.
%out = tosa.add %input1, %input2 : tensor<12x6xsi32>, tensor<1x1xsi32> -> tensor<12x6xsi32>
OPERATION_NAME = 'tosa.add'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.AddOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.AddOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.add'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.add(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.AddShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise addition of input1 and input2. Size of shapes must match.

OPERATION_NAME = 'tosa.add_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.AddShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.AddShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.add_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.add_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ApplyScaleOp(output, value, multiplier, shift, rounding_mode, *, loc=None, ip=None)

Bases: _ods_ir

Applies rescaling for fixed point values. This behavior is replicated in multiple quantized operations (mul, convolution, rescale, matmul, pooling).

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.

OPERATION_NAME = 'tosa.apply_scale'
_ODS_REGIONS = (0, True)
value() _ods_ir
multiplier() _ods_ir
shift() _ods_ir
rounding_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ApplyScaleOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ApplyScaleOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.apply_scale'
value() _ods_ir
multiplier() _ods_ir
shift() _ods_ir
rounding_mode() _ods_ir
mlir.dialects.tosa.apply_scale(output, value, multiplier, shift, rounding_mode, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ArgMaxOp(output, input, axis, *, nan_mode=None, loc=None, ip=None)

Bases: _ods_ir

This returns the index with the largest value across the given axis of the input tensor. If multiple locations have equal values, returns the first match along the search axis.

OPERATION_NAME = 'tosa.argmax'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ArgMaxOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ArgMaxOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.argmax'
input() _ods_ir
axis() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.argmax(output, input, axis, *, nan_mode=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ArithmeticRightShiftOp(output, input1, input2, round, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise arithmetic right shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.arithmetic_right_shift'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
round() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ArithmeticRightShiftOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ArithmeticRightShiftOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.arithmetic_right_shift'
input1() _ods_ir
input2() _ods_ir
round() _ods_ir
mlir.dialects.tosa.arithmetic_right_shift(output, input1, input2, round, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.AssertEqualShapeOp(input1, input2, allow_broadcast, *, loc=None, ip=None)

Bases: _ods_ir

Verify input1 and input2 are equal. If allow_broadcast is set, shapes which are broadcast compatible are allowed.

OPERATION_NAME = 'tosa.assert_equal_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
allow_broadcast() _ods_ir
class mlir.dialects.tosa.AssertEqualShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.AssertEqualShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.assert_equal_shape'
input1() _ods_ir
input2() _ods_ir
allow_broadcast() _ods_ir
mlir.dialects.tosa.assert_equal_shape(input1, input2, allow_broadcast, *, loc=None, ip=None) AssertEqualShapeOp
class mlir.dialects.tosa.AvgPool2dOp(output, input, input_zp, output_zp, kernel, stride, pad, acc_type, *, loc=None, ip=None)

Bases: _ods_ir

This performs an average pooling over the given input tensor. A sliding window of size given by is passed over the input tensor, with the mean value being placed in the output tensor. When calculating the average, only the number of valid input tensor values, but not padding, are used to calculate the divisor.

OPERATION_NAME = 'tosa.avg_pool2d'
_ODS_REGIONS = (0, True)
input() _ods_ir
input_zp() _ods_ir
output_zp() _ods_ir
kernel() _ods_ir
stride() _ods_ir
pad() _ods_ir
acc_type() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.AvgPool2dOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.AvgPool2dOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.avg_pool2d'
input() _ods_ir
input_zp() _ods_ir
output_zp() _ods_ir
kernel() _ods_ir
stride() _ods_ir
pad() _ods_ir
acc_type() _ods_ir
mlir.dialects.tosa.avg_pool2d(output, input, input_zp, output_zp, kernel, stride, pad, acc_type, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.BitwiseAndOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise bitwise AND of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.bitwise_and'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.BitwiseAndOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.BitwiseAndOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.bitwise_and'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.bitwise_and(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.BitwiseNotOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise bitwise NOT of input tensor.

OPERATION_NAME = 'tosa.bitwise_not'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.BitwiseNotOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.BitwiseNotOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.bitwise_not'
input1() _ods_ir
mlir.dialects.tosa.bitwise_not(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.BitwiseOrOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise bitwise OR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.bitwise_or'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.BitwiseOrOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.BitwiseOrOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.bitwise_or'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.bitwise_or(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.BitwiseXorOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise bitwise XOR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.bitwise_xor'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.BitwiseXorOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.BitwiseXorOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.bitwise_xor'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.bitwise_xor(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.CastFromBlockScaledOp(output_data, input_data, input_scale, block_size, *, loc=None, ip=None)

Bases: _ods_ir

Apply the scales from a scale tensor to the values in a value tensor, casting the result to the output type. The block dimension must be the last dimension of the tensor.

OPERATION_NAME = 'tosa.cast_from_block_scaled'
_ODS_REGIONS = (0, True)
input_data() _ods_ir
input_scale() _ods_ir
block_size() _ods_ir
output_data() _ods_ir
class mlir.dialects.tosa.CastFromBlockScaledOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.CastFromBlockScaledOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.cast_from_block_scaled'
input_data() _ods_ir
input_scale() _ods_ir
block_size() _ods_ir
mlir.dialects.tosa.cast_from_block_scaled(output_data, input_data, input_scale, block_size, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.CastOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Casts a tensor from one data type to another.

  • This table is showing the supported conversions from the TOSA Specification.

  • The MLIR dialect here can be used to represent other conversions.

Mode | Input | Output |

|--------------------------|———|---------| | fp16 to fp32 | float16 | float32 | | fp16 to int 16 | float16 | int16 | | fp16 to int 32 | float16 | int32 | | fp16 to int 8 | float16 | int8 | | fp32 to fp16 | float32 | float16 | | fp32 to int 16 | float32 | int16 | | fp32 to int 32 | float32 | int32 | | fp32 to int 8 | float32 | int8 | | int 16 to fp16 | int16 | float16 | | int 16 to fp32 | int16 | float32 | | int 32 to fp16 | int32 | float16 | | int 32 to fp32 | int32 | float32 | | int 8 to fp16 | int8 | float16 | | int 8 to fp32 | int8 | float32 | | bool to int 16 | Boolean | int16 | | bool to int 32 | Boolean | int32 | | bool to int 8 | Boolean | int8 | | int 16 to bool | int16 | Boolean | | int 16 to int 32 | int16 | int32 | | int 16 to int 8 | int16 | int8 | | int 32 to bool | int32 | Boolean | | int 32 to int 16 | int32 | int16 | | int 32 to int 8 | int32 | int8 | | int 8 to bool | int8 | Boolean | | int 8 to int 16 | int8 | int16 | | int 8 to int 32 | int8 | int32 | | bf16 to fp32 | bf16 | float32 | | bf16 to int 16 | bf16 | int16 | | bf16 to int 32 | bf16 | int32 | | bf16 to int 8 | bf16 | int8 | | fp32 to bf16 | float32 | bf16 | | int 16 to bf16 | int16 | bf16 | | int 32 to bf16 | int32 | bf16 | | int 8 to bf16 | int8 | bf16 | | bf16 to fp8e4m3 | bf16 | fp8e4m3 | | fp8e4m3 to bf16 | fp8e4m3 | bf16 | | bf16 to fp8e5m2 | bf16 | fp8e5m2 | | fp8e5m2 to bf16 | fp8e5m2 | bf16 | | fp16 to fp8e4m3 | float16 | fp8e4m3 | | fp32 to fp8e4m3 | float32 | fp8e4m3 | | fp8e4m3 to fp16 | fp8e4m3 | float16 | | fp8e4m3 to fp32 | fp8e4m3 | float32 | | fp16 to fp8e5m2 | float16 | fp8e5m2 | | fp32 to fp8e5m2 | float32 | fp8e5m2 | | fp8e5m2 to fp16 | fp8e5m2 | float16 | | fp8e5m2 to fp32 | fp8e5m2 | float32 |

OPERATION_NAME = 'tosa.cast'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.CastOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.CastOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.cast'
input() _ods_ir
mlir.dialects.tosa.cast(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.CastToBlockScaledOp(output_data, output_scale, input_data, block_size, *, loc=None, ip=None)

Bases: _ods_ir

Calculate a scale value per block of input values and use that to calculate scaled data values from an input tensor. The output tensors are cast to the specified scale and value types. The block dimension will be the last dimension of the tensor.

OPERATION_NAME = 'tosa.cast_to_block_scaled'
_ODS_REGIONS = (0, True)
input_data() _ods_ir
block_size() _ods_ir
output_data() _ods_ir
output_scale() _ods_ir
class mlir.dialects.tosa.CastToBlockScaledOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.CastToBlockScaledOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.cast_to_block_scaled'
input_data() _ods_ir
block_size() _ods_ir
mlir.dialects.tosa.cast_to_block_scaled(output_data, output_scale, input_data, block_size, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.CeilOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise ceiling operation.

OPERATION_NAME = 'tosa.ceil'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.CeilOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.CeilOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.ceil'
input1() _ods_ir
mlir.dialects.tosa.ceil(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ClampOp(output, input, min_val, max_val, *, nan_mode=None, loc=None, ip=None)

Bases: _ods_ir

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.

OPERATION_NAME = 'tosa.clamp'
_ODS_REGIONS = (0, True)
input() _ods_ir
min_val() _ods_ir
max_val() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ClampOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ClampOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.clamp'
input() _ods_ir
min_val() _ods_ir
max_val() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.clamp(output, input, min_val, max_val, *, nan_mode=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ClzOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise count leading zeros operation.

OPERATION_NAME = 'tosa.clz'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ClzOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ClzOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.clz'
input1() _ods_ir
mlir.dialects.tosa.clz(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ConcatOp(input1, axis, *, results=None, loc=None, ip=None)

Bases: _ods_ir

Concatenate a list of tensors along a given axis. No data conversion happens during a concat operation.

OPERATION_NAME = 'tosa.concat'
_ODS_REGIONS = (0, True)
input1() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ConcatOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ConcatOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.concat'
input1() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.concat(input1, axis, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ConcatShapeOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Concatenates a list of shapes into a new shape with length equal to the sum of the lengths of the inputs.

OPERATION_NAME = 'tosa.concat_shape'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ConcatShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ConcatShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.concat_shape'
input() _ods_ir
mlir.dialects.tosa.concat_shape(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ConstOp(values, *, results=None, loc=None, ip=None)

Bases: _ods_ir

A node containing constant data for use as the input to an operation. May hold data in any of the supported data formats.

Example:

// Generic form
%out = "tosa.const"() {values = dense<0> : tensor<2x3xi32>} : () -> tensor<2x3xi32>
OPERATION_NAME = 'tosa.const'
_ODS_REGIONS = (0, True)
values() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ConstOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ConstOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.const'
values() _ods_ir
mlir.dialects.tosa.const(values, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ConstShapeOp(output, values, *, loc=None, ip=None)

Bases: _ods_ir

A node containing a constant shape.

Example:

// Generic form
%out = "tosa.const_shape"() {values = dense<0> : tensor<4xindex>} : () -> !tosa.shape<4>
OPERATION_NAME = 'tosa.const_shape'
_ODS_REGIONS = (0, True)
values() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ConstShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ConstShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.const_shape'
values() _ods_ir
mlir.dialects.tosa.const_shape(output, values, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.Conv2DBlockScaledOp(output, input_data, input_scale, weight_data, weight_scale, bias, pad, stride, dilation, block_size, *, loc=None, ip=None)

Bases: _ods_ir

Performs a 2D convolution over the given input data and scales, using the weight data and scales. Implementations may choose to skip calculation of multiplies in the padding area.

OPERATION_NAME = 'tosa.conv2d_block_scaled'
_ODS_REGIONS = (0, True)
input_data() _ods_ir
input_scale() _ods_ir
weight_data() _ods_ir
weight_scale() _ods_ir
bias() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
block_size() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.Conv2DBlockScaledOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.Conv2DBlockScaledOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.conv2d_block_scaled'
input_data() _ods_ir
input_scale() _ods_ir
weight_data() _ods_ir
weight_scale() _ods_ir
bias() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
block_size() _ods_ir
mlir.dialects.tosa.conv2d_block_scaled(output, input_data, input_scale, weight_data, weight_scale, bias, pad, stride, dilation, block_size, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.Conv2DOp(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None)

Bases: _ods_ir

Performs a 2D convolution over the given tensor input, using the weight tensor. Implementations may choose to skip calculation of multiplies in the padding area.

OPERATION_NAME = 'tosa.conv2d'
_ODS_REGIONS = (0, True)
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
output() _ods_ir
class mlir.dialects.tosa.Conv2DOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.Conv2DOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.conv2d'
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
mlir.dialects.tosa.conv2d(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.Conv3DOp(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None)

Bases: _ods_ir

Performs a 3D convolution over the given input tensor. Implementations may choose to skip calculation of multiplies in the padding area.

OPERATION_NAME = 'tosa.conv3d'
_ODS_REGIONS = (0, True)
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
output() _ods_ir
class mlir.dialects.tosa.Conv3DOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.Conv3DOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.conv3d'
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
mlir.dialects.tosa.conv3d(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.CosOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise cosine operation for values given in radians.

OPERATION_NAME = 'tosa.cos'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.CosOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.CosOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.cos'
input1() _ods_ir
mlir.dialects.tosa.cos(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.CustomOp(output_list, operator_name, domain_name, implementation_attrs, input_list, *, loc=None, ip=None)

Bases: _ods_ir

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.

operator_name is a string that tells the backend which custom operator is being called.

domain_name is a string identifier which can help avoid name collisions on the identifier field.

implementation_attrs is a string which is a backend and identifier specific set of attributes to the custom operator.

input_list is the set of tensor inputs to the custom operator.

output_list is the list of tensors returned by the operator. The number of operators is backend specific.

Example:

%out = tosa.custom %in {domain_name = "tosa_mlir_test", operator_name =
       "custom_test", implementation_attrs = ""}: (tensor<10xi32>) ->
       (tensor<10xi32>)
OPERATION_NAME = 'tosa.custom'
_ODS_REGIONS = (0, True)
input_list() _ods_ir
operator_name() _ods_ir
domain_name() _ods_ir
implementation_attrs() _ods_ir
output_list() _ods_ir
class mlir.dialects.tosa.CustomOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.CustomOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.custom'
input_list() _ods_ir
operator_name() _ods_ir
domain_name() _ods_ir
implementation_attrs() _ods_ir
mlir.dialects.tosa.custom(output_list, operator_name, domain_name, implementation_attrs, input_list, *, loc=None, ip=None) _ods_ir | _ods_ir | CustomOp
class mlir.dialects.tosa.DepthwiseConv2DOp(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None)

Bases: _ods_ir

Performs 2D convolutions separately over each channel of the given tensor input, using the weight tensor. Implementations may choose to skip calculation of multiplies in the padding area.

OPERATION_NAME = 'tosa.depthwise_conv2d'
_ODS_REGIONS = (0, True)
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
output() _ods_ir
class mlir.dialects.tosa.DepthwiseConv2DOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.DepthwiseConv2DOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.depthwise_conv2d'
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
pad() _ods_ir
stride() _ods_ir
dilation() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
mlir.dialects.tosa.depthwise_conv2d(output, input, weight, bias, input_zp, weight_zp, pad, stride, dilation, acc_type, *, local_bound=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.DimOp(output, input1, axis, *, loc=None, ip=None)

Bases: _ods_ir

Returns a length 1 shape_t of the size of the input tensor for the given axis.

OPERATION_NAME = 'tosa.dim'
_ODS_REGIONS = (0, True)
input1() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.DimOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.DimOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.dim'
input1() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.dim(output, input1, axis, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.DivCeilShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise divide of input1 by input2. The result of the divide is rounded up.

OPERATION_NAME = 'tosa.div_ceil_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.DivCeilShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.DivCeilShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.div_ceil_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.div_ceil_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.DivFloorShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise integer divide of input1 by input2. The result of the divide is rounded down.

OPERATION_NAME = 'tosa.div_floor_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.DivFloorShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.DivFloorShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.div_floor_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.div_floor_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.EqualOp(input1, input2, *, results=None, loc=None, ip=None)

Bases: _ods_ir

Elementwise comparison operation.

OPERATION_NAME = 'tosa.equal'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.EqualOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.EqualOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.equal'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.equal(input1, input2, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ErfOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

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 precision and covering the input range -4.0 to +4.0 in steps of 1/64.

OPERATION_NAME = 'tosa.erf'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ErfOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ErfOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.erf'
input() _ods_ir
mlir.dialects.tosa.erf(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.Exp2ShapeOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Computation of raising two to the power of each element in input.

OPERATION_NAME = 'tosa.exp2_shape'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.Exp2ShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.Exp2ShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.exp2_shape'
input() _ods_ir
mlir.dialects.tosa.exp2_shape(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ExpOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise e to the x operation

OPERATION_NAME = 'tosa.exp'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ExpOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ExpOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.exp'
input1() _ods_ir
mlir.dialects.tosa.exp(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.FFT2dOp(output_real, output_imag, input_real, input_imag, inverse, *, local_bound=None, loc=None, ip=None)

Bases: _ods_ir

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.

Example:

%output_real, %output_imag = tosa.fft2d %input_real, %input_imag : (tensor<8x9xf32>, tensor<8x9xf32>) -> (tensor<8x9xf32>, tensor<8x9xf32>)
OPERATION_NAME = 'tosa.fft2d'
_ODS_REGIONS = (0, True)
input_real() _ods_ir
input_imag() _ods_ir
inverse() _ods_ir
local_bound() _ods_ir | None
output_real() _ods_ir
output_imag() _ods_ir
class mlir.dialects.tosa.FFT2dOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.FFT2dOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.fft2d'
input_real() _ods_ir
input_imag() _ods_ir
inverse() _ods_ir
local_bound() _ods_ir | None
mlir.dialects.tosa.fft2d(output_real, output_imag, input_real, input_imag, inverse, *, local_bound=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.FloorOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise floor operation.

OPERATION_NAME = 'tosa.floor'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.FloorOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.FloorOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.floor'
input1() _ods_ir
mlir.dialects.tosa.floor(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.GatherOp(output, values, indices, *, loc=None, ip=None)

Bases: _ods_ir

Generate a tensor for which each element in the output is a subtensor of the values tensor based on the indices. N is the number of batches, W the number of indices in each batch, K the range of each index and C the number data channels for each index.

OPERATION_NAME = 'tosa.gather'
_ODS_REGIONS = (0, True)
values() _ods_ir
indices() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.GatherOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.GatherOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.gather'
values() _ods_ir
indices() _ods_ir
mlir.dialects.tosa.gather(output, values, indices, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.GreaterEqualOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise comparison operation.

OPERATION_NAME = 'tosa.greater_equal'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.GreaterEqualOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.GreaterEqualOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.greater_equal'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.greater_equal(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.GreaterOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise greater than comparison operation.

OPERATION_NAME = 'tosa.greater'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.GreaterOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.GreaterOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.greater'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.greater(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.IdentityOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Returns a tensor with the same shape, type, and contents as the input.

OPERATION_NAME = 'tosa.identity'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.IdentityOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.IdentityOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.identity'
input1() _ods_ir
mlir.dialects.tosa.identity(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.IfOp(output_list, condition, input_list, *, loc=None, ip=None)

Bases: _ods_ir

Evaluates a Boolean condition and then takes one of two distinct execution paths. This implements the semantic If-then-else structure.

OPERATION_NAME = 'tosa.cond_if'
_ODS_REGIONS = (2, True)
condition() _ods_ir
input_list() _ods_ir
output_list() _ods_ir
then_graph() _ods_ir
else_graph() _ods_ir
class mlir.dialects.tosa.IfOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.IfOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.cond_if'
condition() _ods_ir
input_list() _ods_ir
mlir.dialects.tosa.cond_if(output_list, condition, input_list, *, loc=None, ip=None) _ods_ir | _ods_ir | IfOp
class mlir.dialects.tosa.IntDivOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise integer divide of input1 by input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match. The result of the divide is truncated towards zero. Expected use is for operations on non-scaled integers. Floating point divide should use RECIPROCAL and MUL. Quantized integer divide should use TABLE (for 1/x) and MUL.

OPERATION_NAME = 'tosa.intdiv'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.IntDivOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.IntDivOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.intdiv'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.intdiv(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.Log2CeilShapeOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Computation of the base two logarithm of each element in input. Result is rounded up.

OPERATION_NAME = 'tosa.log2_ceil_shape'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.Log2CeilShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.Log2CeilShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.log2_ceil_shape'
input() _ods_ir
mlir.dialects.tosa.log2_ceil_shape(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.Log2FloorShapeOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Computation of the base two logarithm of each element in input. Result is rounded down.

OPERATION_NAME = 'tosa.log2_floor_shape'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.Log2FloorShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.Log2FloorShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.log2_floor_shape'
input() _ods_ir
mlir.dialects.tosa.log2_floor_shape(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise natural logarithm operation

OPERATION_NAME = 'tosa.log'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.log'
input1() _ods_ir
mlir.dialects.tosa.log(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogicalAndOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise logical AND of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.logical_and'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogicalAndOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogicalAndOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.logical_and'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.logical_and(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogicalLeftShiftOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise logical left-shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.logical_left_shift'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogicalLeftShiftOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogicalLeftShiftOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.logical_left_shift'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.logical_left_shift(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogicalNotOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise logical NOT of input.

OPERATION_NAME = 'tosa.logical_not'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogicalNotOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogicalNotOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.logical_not'
input1() _ods_ir
mlir.dialects.tosa.logical_not(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogicalOrOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise logical OR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.logical_or'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogicalOrOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogicalOrOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.logical_or'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.logical_or(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogicalRightShiftOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise logical right shift of input1 by the amount specified in input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.logical_right_shift'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogicalRightShiftOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogicalRightShiftOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.logical_right_shift'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.logical_right_shift(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.LogicalXorOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise logical XOR of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.logical_xor'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.LogicalXorOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.LogicalXorOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.logical_xor'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.logical_xor(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MatMulOp(output, a, b, a_zp, b_zp, *, loc=None, ip=None)

Bases: _ods_ir

Performs two dimensional matrix multiplications.

OPERATION_NAME = 'tosa.matmul'
_ODS_REGIONS = (0, True)
a() _ods_ir
b() _ods_ir
a_zp() _ods_ir
b_zp() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MatMulOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MatMulOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.matmul'
a() _ods_ir
b() _ods_ir
a_zp() _ods_ir
b_zp() _ods_ir
mlir.dialects.tosa.matmul(output, a, b, a_zp, b_zp, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MatmulTBlockScaledOp(output_data, a_data, a_scale, b_data, b_scale, block_size, *, loc=None, ip=None)

Bases: _ods_ir

Performs two dimensional matrix multiplications using block scaled tensors. The block dimension is always the the last dimension of the tensor, so the result is effectively a matrix multiply of A by the transposed B matrix. If the N dimension of input B is of size 1, the B matrix will be broadcast.

OPERATION_NAME = 'tosa.matmul_t_block_scaled'
_ODS_REGIONS = (0, True)
a_data() _ods_ir
a_scale() _ods_ir
b_data() _ods_ir
b_scale() _ods_ir
block_size() _ods_ir
output_data() _ods_ir
class mlir.dialects.tosa.MatmulTBlockScaledOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MatmulTBlockScaledOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.matmul_t_block_scaled'
a_data() _ods_ir
a_scale() _ods_ir
b_data() _ods_ir
b_scale() _ods_ir
block_size() _ods_ir
mlir.dialects.tosa.matmul_t_block_scaled(output_data, a_data, a_scale, b_data, b_scale, block_size, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MaxPool2dOp(output, input, kernel, stride, pad, *, nan_mode=None, loc=None, ip=None)

Bases: _ods_ir

This performs a max pooling over the given input tensor. A sliding window of size given by is passed over the input tensor, with the maximum value being placed in the output tensor.

OPERATION_NAME = 'tosa.max_pool2d'
_ODS_REGIONS = (0, True)
input() _ods_ir
kernel() _ods_ir
stride() _ods_ir
pad() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MaxPool2dOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MaxPool2dOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.max_pool2d'
input() _ods_ir
kernel() _ods_ir
stride() _ods_ir
pad() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.max_pool2d(output, input, kernel, stride, pad, *, nan_mode=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MaxShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise maximum of input1 and input2.

OPERATION_NAME = 'tosa.max_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MaxShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MaxShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.max_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.max_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MaximumOp(output, input1, input2, *, nan_mode=None, loc=None, ip=None)

Bases: _ods_ir

Elementwise max of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.maximum'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MaximumOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MaximumOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.maximum'
input1() _ods_ir
input2() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.maximum(output, input1, input2, *, nan_mode=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MinShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise minimum of input1 and input2.

OPERATION_NAME = 'tosa.min_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MinShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MinShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.min_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.min_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MinimumOp(output, input1, input2, *, nan_mode=None, loc=None, ip=None)

Bases: _ods_ir

Elementwise minimum of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.minimum'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MinimumOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MinimumOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.minimum'
input1() _ods_ir
input2() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.minimum(output, input1, input2, *, nan_mode=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ModShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise modulo of input1 divided by input2.

OPERATION_NAME = 'tosa.mod_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ModShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ModShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.mod_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.mod_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MulOp(output, input1, input2, shift, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise multiplication (Hadamard product) of input1 and input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.mul'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
shift() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MulOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MulOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.mul'
input1() _ods_ir
input2() _ods_ir
shift() _ods_ir
mlir.dialects.tosa.mul(output, input1, input2, shift, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.MulShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise multiplication of input1 and input2.

OPERATION_NAME = 'tosa.mul_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.MulShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.MulShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.mul_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.mul_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.NegateOp(output, input1, input1_zp, output_zp, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise negation operation.

OPERATION_NAME = 'tosa.negate'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input1_zp() _ods_ir
output_zp() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.NegateOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.NegateOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.negate'
input1() _ods_ir
input1_zp() _ods_ir
output_zp() _ods_ir
mlir.dialects.tosa.negate(output, input1, input1_zp, output_zp, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.PadOp(output, input1, padding, pad_const, *, loc=None, ip=None)

Bases: _ods_ir

Pads a tensor along the borders of each dimension with a supplied value. Returns a new tensor with the padding included. The pad_const value includes the zero point if the tensor uses a zero point.

Example:

%pad_const = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32>
%padding = tosa.const_shape {values = dense<[1, 2, 3, 4]> : tensor<4xindex>} : () -> !tosa.shape<4>
tosa.pad %arg0, %padding, %pad_const: (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>)  -> (tensor<4x9xf32>)

Example 2:

%pad_const = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32>
%padding = tosa.const_shape {values = dense<[-1, 2, 3, 4]> : tensor<4xindex>} : () -> !tosa.shape<4>
tosa.pad %arg0, %padding, %pad_const : (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>)  -> (tensor<?x9xf32>)
OPERATION_NAME = 'tosa.pad'
_ODS_REGIONS = (0, True)
input1() _ods_ir
padding() _ods_ir
pad_const() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.PadOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.PadOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.pad'
input1() _ods_ir
padding() _ods_ir
pad_const() _ods_ir
mlir.dialects.tosa.pad(output, input1, padding, pad_const, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.PowOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise input1 value raised to the power of input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.pow'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.PowOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.PowOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.pow'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.pow(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.RFFT2dOp(output_real, output_imag, input_real, *, local_bound=None, loc=None, ip=None)

Bases: _ods_ir

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. Implementations may choose to skip calculation of the imaginary values at (0,0), (0,W/2), (H/2,0), and (H/2, W/2). If the calculation is skipped, the result at that location must be zero.

Example:

%ouput_real, %output_imag = tosa.rfft2d %input_real : (tensor<8x16xf32>) -> (tensor<8x9xf32>, tensor<8x9xf32>)
OPERATION_NAME = 'tosa.rfft2d'
_ODS_REGIONS = (0, True)
input_real() _ods_ir
local_bound() _ods_ir | None
output_real() _ods_ir
output_imag() _ods_ir
class mlir.dialects.tosa.RFFT2dOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.RFFT2dOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.rfft2d'
input_real() _ods_ir
local_bound() _ods_ir | None
mlir.dialects.tosa.rfft2d(output_real, output_imag, input_real, *, local_bound=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReciprocalOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise reciprocal operation. For integer operation, a TABLE should be used with the appropriate ranges.

OPERATION_NAME = 'tosa.reciprocal'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReciprocalOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReciprocalOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reciprocal'
input1() _ods_ir
mlir.dialects.tosa.reciprocal(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReduceAllOp(input, axis, *, results=None, loc=None, ip=None)

Bases: _ods_ir

Reduce a tensor along the given axis with a logical AND operation.

OPERATION_NAME = 'tosa.reduce_all'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReduceAllOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReduceAllOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reduce_all'
input() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.reduce_all(input, axis, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReduceAnyOp(input, axis, *, results=None, loc=None, ip=None)

Bases: _ods_ir

Reduce a tensor along the given axis with a logical OR operation.

OPERATION_NAME = 'tosa.reduce_any'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReduceAnyOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReduceAnyOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reduce_any'
input() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.reduce_any(input, axis, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReduceMaxOp(input, axis, *, nan_mode=None, results=None, loc=None, ip=None)

Bases: _ods_ir

Reduce a tensor along the given axis with a maximum operation.

OPERATION_NAME = 'tosa.reduce_max'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReduceMaxOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReduceMaxOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reduce_max'
input() _ods_ir
axis() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.reduce_max(input, axis, *, nan_mode=None, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReduceMinOp(input, axis, *, nan_mode=None, results=None, loc=None, ip=None)

Bases: _ods_ir

Reduce a tensor along the given axis with a minimum operation.

OPERATION_NAME = 'tosa.reduce_min'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
nan_mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReduceMinOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReduceMinOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reduce_min'
input() _ods_ir
axis() _ods_ir
nan_mode() _ods_ir
mlir.dialects.tosa.reduce_min(input, axis, *, nan_mode=None, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReduceProductOp(input, axis, *, results=None, loc=None, ip=None)

Bases: _ods_ir

Reduce a tensor along the given axis by computing the product of the axis.

OPERATION_NAME = 'tosa.reduce_product'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReduceProductOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReduceProductOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reduce_product'
input() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.reduce_product(input, axis, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReduceSumOp(input, axis, *, results=None, loc=None, ip=None)

Bases: _ods_ir

Reduce a tensor along the given axis by computing the sum of the axis.

OPERATION_NAME = 'tosa.reduce_sum'
_ODS_REGIONS = (0, True)
input() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReduceSumOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReduceSumOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reduce_sum'
input() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.reduce_sum(input, axis, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.RescaleOp(output, input, multiplier, shift, input_zp, output_zp, scale32, rounding_mode, per_channel, input_unsigned, output_unsigned, *, loc=None, ip=None)

Bases: _ods_ir

RESCALE is defined using an integer multiply, add, and shift.

Rescale supports two precisions of multiplier: 16-bit and 32-bit. The 32-bit multiplier version supports two rounding modes to enable simpler lowering of existing frameworks that use two stage rounding. All arithmetic is designed so that it does not overflow a 64-bit accumulator and that the result fits in 32 bits. In particular, a 48-bit value cannot be scaled with the 32-bit multiplier because the accumulator would need to have 80 bits.

The shift and value range are limited to allow a variety of implementations. The limit of 62 on shift allows the shift to be decomposed as two right shifts of 31.

Supported rescalings:

  • This table is showing the supported conversions from the TOSA Specification.

  • The MLIR dialect here can be used to represent other conversions.

Mode | Input | Output | Unsigned input | Unsigned output |

|------------------------|——-|--------|—————-|-----------------| | signed 16 to 16 | int16 | int16 | false | false | | signed 16 to 32 | int16 | int32 | false | false | | signed 16 to 8 | int16 | int8 | false | false | | signed 32 to 16 | int32 | int16 | false | false | | signed 32 to 32 | int32 | int32 | false | false | | signed 32 to 8 | int32 | int8 | false | false | | signed 8 to 16 | int8 | int16 | false | false | | signed 8 to 32 | int8 | int32 | false | false | | signed 8 to 8 | int8 | int8 | false | false | | signed 48 to 16 | int48 | int16 | false | false | | signed 48 to 32 | int48 | int32 | false | false | | signed 48 to 8 | int48 | int8 | false | false | | unsigned 8 to signed 8 | uint8 | int8 | true | false | | signed 8 to unsigned 8 | int8 | uint8 | false | true |

OPERATION_NAME = 'tosa.rescale'
_ODS_REGIONS = (0, True)
input() _ods_ir
multiplier() _ods_ir[_ods_ir]
shift() _ods_ir[_ods_ir]
input_zp() _ods_ir
output_zp() _ods_ir
scale32() _ods_ir
rounding_mode() _ods_ir
per_channel() _ods_ir
input_unsigned() _ods_ir
output_unsigned() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.RescaleOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.RescaleOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.rescale'
input() _ods_ir
multiplier() _ods_ir[_ods_ir]
shift() _ods_ir[_ods_ir]
input_zp() _ods_ir
output_zp() _ods_ir
scale32() _ods_ir
rounding_mode() _ods_ir
per_channel() _ods_ir
input_unsigned() _ods_ir
output_unsigned() _ods_ir
mlir.dialects.tosa.rescale(output, input, multiplier, shift, input_zp, output_zp, scale32, rounding_mode, per_channel, input_unsigned, output_unsigned, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReshapeOp(input1, shape, *, results=None, loc=None, ip=None)

Bases: _ods_ir

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.

OPERATION_NAME = 'tosa.reshape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
shape() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReshapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReshapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reshape'
input1() _ods_ir
shape() _ods_ir
mlir.dialects.tosa.reshape(input1, shape, *, results=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ResizeOp(output, input, scale, offset, border, mode, *, loc=None, ip=None)

Bases: _ods_ir

Resizes a tensor. Resize is only allowed in the H and W dimensions.

The height dimension is scaled by factor (scale_y_n/scale_y_d). The width dimension is scaled by factor (scale_x_n/scale_x_d).

The NEAREST_NEIGHBOR mode returns the value of the input tensor closest to the calculated sample position for both floating-point and integer data formats.

Floating-point BILINEAR mode returns a bilinearly interpolated output value based on the four closest input sample positions.

For integer BILINEAR interpolation mode, the output value must be scaled by 1/(scale_y_n * scale_x_n) in a following operation to complete the interpolation (for example with a RESCALE operator).

The output dimensions can be derived from the input dimensions by inverting the scale as described in the pseudocode. The [border_y, border_x] values adjust the output size to allow fractional sampling beyond integer input position (IH - 1,IW - 1).

The limit MAX_SCALE is applied to each scale ratio after reduction of the ratio. Individual scale numerator and denominator values are allowed to be larger than MAX_SCALE.

OPERATION_NAME = 'tosa.resize'
_ODS_REGIONS = (0, True)
input() _ods_ir
scale() _ods_ir
offset() _ods_ir
border() _ods_ir
mode() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ResizeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ResizeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.resize'
input() _ods_ir
scale() _ods_ir
offset() _ods_ir
border() _ods_ir
mode() _ods_ir
mlir.dialects.tosa.resize(output, input, scale, offset, border, mode, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ReverseOp(output, input1, axis, *, loc=None, ip=None)

Bases: _ods_ir

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.

OPERATION_NAME = 'tosa.reverse'
_ODS_REGIONS = (0, True)
input1() _ods_ir
axis() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.ReverseOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ReverseOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.reverse'
input1() _ods_ir
axis() _ods_ir
mlir.dialects.tosa.reverse(output, input1, axis, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.RsqrtOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise reciprocal square root operation. For integer operation, a TABLE should be used with the appropriate ranges.

OPERATION_NAME = 'tosa.rsqrt'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.RsqrtOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.RsqrtOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.rsqrt'
input1() _ods_ir
mlir.dialects.tosa.rsqrt(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.ScatterOp(values_out, values_in, indices, input, *, loc=None, ip=None)

Bases: _ods_ir

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. N is the number of batches, W the number of indices in each batch, K the range of each index and C the number data channels for each index. It is not permitted to repeat the same output index within a single SCATTER operation and so each output index occurs at most once. It follows that K >= W. In use cases that require multiple updates to the same output position, these must be decomposed into multiple SCATTER operations.

OPERATION_NAME = 'tosa.scatter'
_ODS_REGIONS = (0, True)
values_in() _ods_ir
indices() _ods_ir
input() _ods_ir
values_out() _ods_ir
class mlir.dialects.tosa.ScatterOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.ScatterOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.scatter'
values_in() _ods_ir
indices() _ods_ir
input() _ods_ir
mlir.dialects.tosa.scatter(values_out, values_in, indices, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SelectOp(output, input1, input2, input3, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise select of the output based on a condition.

OPERATION_NAME = 'tosa.select'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
input3() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SelectOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SelectOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.select'
input1() _ods_ir
input2() _ods_ir
input3() _ods_ir
mlir.dialects.tosa.select(output, input1, input2, input3, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SigmoidOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Applies the sigmoid logistic function to each element of the input tensor: $ sigmoid(x) = frac{1}{1 + e^{-x}} $.

For quantized integer data types, the TABLE operator should be used instead. Each implementation may choose an appropriate TABLE given the scale and zero point of the input data. Eight or sixteen bit precision tables may be used based on the input tensor to the sigmoid function.

OPERATION_NAME = 'tosa.sigmoid'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SigmoidOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SigmoidOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.sigmoid'
input() _ods_ir
mlir.dialects.tosa.sigmoid(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SinOp(output, input1, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise sine operation for values given in radians.

OPERATION_NAME = 'tosa.sin'
_ODS_REGIONS = (0, True)
input1() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SinOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SinOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.sin'
input1() _ods_ir
mlir.dialects.tosa.sin(output, input1, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SliceOp(output, input1, start, size, *, loc=None, ip=None)

Bases: _ods_ir

Extracts a slice of input1, beginning at the start coordinates, and extending for size elements in each direction. No data conversion happens during a slice operation.

OPERATION_NAME = 'tosa.slice'
_ODS_REGIONS = (0, True)
input1() _ods_ir
start() _ods_ir
size() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SliceOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SliceOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.slice'
input1() _ods_ir
start() _ods_ir
size() _ods_ir
mlir.dialects.tosa.slice(output, input1, start, size, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SliceShapeOp(output, input, start, size, *, loc=None, ip=None)

Bases: _ods_ir

Extract a shape of size from input.

OPERATION_NAME = 'tosa.slice_shape'
_ODS_REGIONS = (0, True)
input() _ods_ir
start() _ods_ir
size() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SliceShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SliceShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.slice_shape'
input() _ods_ir
start() _ods_ir
size() _ods_ir
mlir.dialects.tosa.slice_shape(output, input, start, size, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SubOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise subtraction of input1 and input2. Axis of size 1 will be broadcast as necessary. Rank of input tensors must match.

OPERATION_NAME = 'tosa.sub'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SubOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SubOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.sub'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.sub(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.SubShapeOp(output, input1, input2, *, loc=None, ip=None)

Bases: _ods_ir

Elementwise subtraction of input1 and input2. Size of shapes must match.

OPERATION_NAME = 'tosa.sub_shape'
_ODS_REGIONS = (0, True)
input1() _ods_ir
input2() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.SubShapeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.SubShapeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.sub_shape'
input1() _ods_ir
input2() _ods_ir
mlir.dialects.tosa.sub_shape(output, input1, input2, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.TableOp(output, input1, table, *, loc=None, ip=None)

Bases: _ods_ir

Table lookup operation. For int8_t TABLE operation, perform a 256 entry table lookup returning an int8_t value. For int16_t tables, the int16_t input is treated as a fixed-point 9.7 value. The most significant 9 bits are used to index into the table. The fractional 7 bits are used to interpolate based on table[index] and table[index+1]. For int16_t inputs, the TABLE operator returns a 16.7 interpolated value in an int32_t. This value can then be input to the RESCALE operator to scale to the required output data type. Note that int16_t table has 513 values to handle table[index+1] when index=511.

An int16_t to int16_t table lookup can be constructed in TOSA as follows:

  • Use the TABLE operator to produce a fixed point 16.7 interpolated result

  • Use RESCALE (in_t=int32_t, out_t=int16_t, scale=1<<14, shift=21) to

scale the output to int16_t range (or alternate scale as required)

OPERATION_NAME = 'tosa.table'
_ODS_REGIONS = (0, True)
input1() _ods_ir
table() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.TableOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.TableOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.table'
input1() _ods_ir
table() _ods_ir
mlir.dialects.tosa.table(output, input1, table, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.TanhOp(output, input, *, loc=None, ip=None)

Bases: _ods_ir

Parameterized hyperbolic tangent: $ tanh(x) = frac{1 - e^{-2x}}{1 + e^{-2x}} $.

For quantized integer data types, the TABLE operator should be used instead. Each implementation may choose an appropriate TABLE given the scale and zero point of the input data. Eight or sixteen bit precision tables may be used based on the input tensor to the tanh function.

OPERATION_NAME = 'tosa.tanh'
_ODS_REGIONS = (0, True)
input() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.TanhOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.TanhOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.tanh'
input() _ods_ir
mlir.dialects.tosa.tanh(output, input, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.TileOp(output, input1, multiples, *, loc=None, ip=None)

Bases: _ods_ir

Replicates input1 multiples times along each dimension.

OPERATION_NAME = 'tosa.tile'
_ODS_REGIONS = (0, True)
input1() _ods_ir
multiples() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.TileOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.TileOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.tile'
input1() _ods_ir
multiples() _ods_ir
mlir.dialects.tosa.tile(output, input1, multiples, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.TransposeConv2DOp(output, input, weight, bias, input_zp, weight_zp, out_pad, stride, acc_type, *, local_bound=None, loc=None, ip=None)

Bases: _ods_ir

Performs a 2D transposed convolution over the given tensor input, using the weights tensor. Implementations may choose to skip calculation of multiplies by zero at fractional input positions.

OPERATION_NAME = 'tosa.transpose_conv2d'
_ODS_REGIONS = (0, True)
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
out_pad() _ods_ir
stride() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
output() _ods_ir
class mlir.dialects.tosa.TransposeConv2DOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.TransposeConv2DOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.transpose_conv2d'
input() _ods_ir
weight() _ods_ir
bias() _ods_ir
input_zp() _ods_ir
weight_zp() _ods_ir
out_pad() _ods_ir
stride() _ods_ir
acc_type() _ods_ir
local_bound() _ods_ir | None
mlir.dialects.tosa.transpose_conv2d(output, input, weight, bias, input_zp, weight_zp, out_pad, stride, acc_type, *, local_bound=None, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.TransposeOp(output, input1, perms, *, loc=None, ip=None)

Bases: _ods_ir

Permutes the dimensions of the input tensor input1 based on the perms argument. Each value in the perms list must be a valid dimension of the input tensor and may not be repeated.

OPERATION_NAME = 'tosa.transpose'
_ODS_REGIONS = (0, True)
input1() _ods_ir
perms() _ods_ir
output() _ods_ir
class mlir.dialects.tosa.TransposeOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.TransposeOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.transpose'
input1() _ods_ir
perms() _ods_ir
mlir.dialects.tosa.transpose(output, input1, perms, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.VariableOp(sym_name, var_shape, type_, *, initial_value=None, loc=None, ip=None)

Bases: _ods_ir

Defines a new TOSA variable. This is a persistent mutable value across multiple TOSA graph invocations. Modifications are expressed using read/write semantics.

OPERATION_NAME = 'tosa.variable'
_ODS_REGIONS = (0, True)
sym_name() _ods_ir
var_shape() _ods_ir
type_() _ods_ir
initial_value() _ods_ir | None
class mlir.dialects.tosa.VariableOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.VariableOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.variable'
sym_name() _ods_ir
var_shape() _ods_ir
type_() _ods_ir
initial_value() _ods_ir | None
mlir.dialects.tosa.variable(sym_name, var_shape, type_, *, initial_value=None, loc=None, ip=None) VariableOp
class mlir.dialects.tosa.VariableReadOp(output1, name, *, loc=None, ip=None)

Bases: _ods_ir

Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.

OPERATION_NAME = 'tosa.variable_read'
_ODS_REGIONS = (0, True)
name() _ods_ir

Returns the fully qualified name of the operation.

output1() _ods_ir
class mlir.dialects.tosa.VariableReadOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.VariableReadOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.variable_read'
name() _ods_ir
mlir.dialects.tosa.variable_read(output1, name, *, loc=None, ip=None) _ods_ir
class mlir.dialects.tosa.VariableWriteOp(name, input1, *, loc=None, ip=None)

Bases: _ods_ir

Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.

OPERATION_NAME = 'tosa.variable_write'
_ODS_REGIONS = (0, True)
input1() _ods_ir
name() _ods_ir

Returns the fully qualified name of the operation.

class mlir.dialects.tosa.VariableWriteOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.VariableWriteOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.variable_write'
input1() _ods_ir
name() _ods_ir
mlir.dialects.tosa.variable_write(name, input1, *, loc=None, ip=None) VariableWriteOp
class mlir.dialects.tosa.WhileOp(output_list, input_list, *, loc=None, ip=None)

Bases: _ods_ir

Generates and evaluates a Boolean condition and either executes a loop body or exits the loop. 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.

OPERATION_NAME = 'tosa.while_loop'
_ODS_REGIONS = (2, True)
input_list() _ods_ir
output_list() _ods_ir
cond_graph() _ods_ir
body_graph() _ods_ir
class mlir.dialects.tosa.WhileOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.WhileOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.while_loop'
input_list() _ods_ir
mlir.dialects.tosa.while_loop(output_list, input_list, *, loc=None, ip=None) _ods_ir | _ods_ir | WhileOp
class mlir.dialects.tosa.YieldOp(inputs, *, loc=None, ip=None)

Bases: _ods_ir

return operation within the conditional and body of structured control flow. Operation takes variadic operands but produces no results of its own.

OPERATION_NAME = 'tosa.yield'
_ODS_REGIONS = (0, True)
inputs() _ods_ir
class mlir.dialects.tosa.YieldOpAdaptor(operands: list, attributes: OpAttributeMap)
class mlir.dialects.tosa.YieldOpAdaptor(operands: list, opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'tosa.yield'
inputs() _ods_ir
mlir.dialects.tosa.yield_(inputs, *, loc=None, ip=None) YieldOp