TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

Operation definition

tfl.abs (TFL::AbsOp)

Absolute value operator

Description:

Given a tensor x, this operation returns a tensor containing the absolute value of each element in x. For example, if x is an input element and y is an output element, this operation computes \(y = |x|\).

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.add_n (TFL::AddNOp)

add_n operator

Description:

Adds all input tensors element-wise.

Operands:

  1. inputs: tensor of 32-bit float or 32-bit integer values

Attributes:

Results:

  1. sum: tensor of 32-bit float or 32-bit integer values

tfl.add (TFL::AddOp)

Addition operator

Description:

Element-wise addition operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Attribute MLIR Type Description
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of any type values

tfl.average_pool_2d (TFL::AveragePool2DOp)

Average_pool_2d operator

Description:

Performs average-pooling operation on input.

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
filter_height IntegerAttr 32-bit integer attribute attribute
filter_width IntegerAttr 32-bit integer attribute attribute
padding StringAttr padding enum attribute
stride_h IntegerAttr 32-bit integer attribute attribute
stride_w IntegerAttr 32-bit integer attribute attribute
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of any type values

tfl.batch_to_space_nd (TFL::BatchToSpaceNdOp)

BatchToSpaceNd operator

Description:

This operation reshapes the "batch" dimension 0 into space dimensions.

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values
  2. block_shape: tensor of 32-bit integer values
  3. indices: tensor of 32-bit integer values

Attributes:

Results:

  1. output: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

tfl.ceil (TFL::CeilOp)

Ceil operator

Description:

Returns element-wise ceil value of the input.

Operands:

  1. x: tensor of floating-point values

Attributes:

Results:

  1. y: tensor of floating-point values

tfl.concatenation (TFL::ConcatenationOp)

Concatenation operator

Description:

Concatenates tensors along one dimension

Operands:

  1. values: tensor of 32-bit float or 64-bit integer or 32-bit integer or 16-bit integer or 8-bit integer or quantized type with 8 bits storage type values

Attributes:

Attribute MLIR Type Description
axis IntegerAttr 32-bit integer attribute attribute
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of 32-bit float or 64-bit integer or 32-bit integer or 16-bit integer or 8-bit integer or quantized type with 8 bits storage type values

tfl.pseudo_const (TFL::ConstOp)

Constant pseudo op.

Description:

Represents a constant value in TensorFlow Lite dialect. This is not an actual operation and it will be lowered to buffer instead.

The op is allowed to have all the same type of attributes as tf.Const does (e.g., opaque TF attributes are allowed).

Operands:

Attributes:

Attribute MLIR Type Description
value ElementsAttr constant vector/tensor attribute attribute

Results:

  1. output: tensor of any type values

tfl.conv_2d (TFL::Conv2DOp)

Convolution operator

Description:

Performs convolution operation on inputs.

Inputs: inputs[0]: required: the input activation tensor inputs[1]: required: the filter weight tensor inputs[2]: optional: the bias tensor

Operands:

  1. input: tensor of any type values
  2. filter: tensor of any type values
  3. bias: tensor of any type values

Attributes:

Attribute MLIR Type Description
dilation_h_factor IntegerAttr 32-bit integer attribute attribute
dilation_w_factor IntegerAttr 32-bit integer attribute attribute
fused_activation_function StringAttr fused activation enum attribute
padding StringAttr padding enum attribute
stride_h IntegerAttr 32-bit integer attribute attribute
stride_w IntegerAttr 32-bit integer attribute attribute

Results:

  1. output: tensor of any type values

tfl.cos (TFL::CosOp)

Cosine operator

Description:

Computes element-wise Cosine of input

Operands:

  1. x: tensor of floating-point values

Attributes:

Results:

  1. y: tensor of floating-point values

tfl.depthwise_conv_2d (TFL::DepthwiseConv2DOp)

Depthwise-separable convolution operator

Description:

Performs convolution operation on inputs.

Inputs: inputs[0]: required: the input activation tensor inputs[1]: required: the filter weight tensor inputs[2]: optional: the bias tensor

Operands:

  1. input: tensor of any type values
  2. filter: tensor of any type values
  3. bias: tensor of any type values

Attributes:

Attribute MLIR Type Description
dilation_h_factor IntegerAttr 32-bit integer attribute attribute
dilation_w_factor IntegerAttr 32-bit integer attribute attribute
fused_activation_function StringAttr fused activation enum attribute
padding StringAttr padding enum attribute
stride_h IntegerAttr 32-bit integer attribute attribute
stride_w IntegerAttr 32-bit integer attribute attribute
depth_multiplier IntegerAttr 32-bit integer attribute attribute

Results:

  1. output: tensor of any type values

tfl.dequantize (TFL::DequantizeOp)

Dequantize operator

Description:

Converts quantized array of integers to floating-points according to the quantization parameters.

Operands:

  1. input: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.div (TFL::DivOp)

Division operator

Description:

Element-wise division operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Attribute MLIR Type Description
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of any type values

tfl.elu (TFL::EluOp)

Exponential Linear Unit operator

Description:

Computes the exponential linear f(x) -> exp(x) - 1 for x < 0, x for x >= 0. element-wise.

Operands:

  1. x: tensor of floating-point values

Attributes:

Results:

  1. y: tensor of any type values

tfl.equal (TFL::EqualOp)

Equal operator

Description:

Returns the truth element of x == y element-wise

Operands:

  1. x: tensor of 1-bit integer or 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values
  2. y: tensor of 1-bit integer or 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.exp (TFL::ExpOp)

Natural exponentiation operator

Description:

Performs element-wise natural exponentiation operation on input.

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.expand_dims (TFL::ExpandDimsOp)

Inserts a dimension of 1 into a tensor's shape.

Description:

Given a tensor input, this operation inserts a dimension of 1 at the dimension index axis of input's shape. The dimension index axis starts at zero; if you specify a negative number for axis it is counted backward from the end.

This operation is useful if you want to add a batch dimension to a single element. For example, if you have a single image of shape [height, width, channels], you can make it a batch of 1 image with expand_dims(image, 0), which will make the shape [1, height, width, channels].

Other examples:

# 't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2]
shape(expand_dims(t, 1)) ==> [2, 1]
shape(expand_dims(t, -1)) ==> [2, 1]

# 't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]

This operation requires that:

-1-input.dims() <= dim <= input.dims()

This operation is related to squeeze(), which removes dimensions of size 1.

Operands:

  1. input: tensor of any type values
  2. dim: tensor of any integer type

Attributes:

Results:

  1. output: tensor of any type values

tfl.fake_quant (TFL::FakeQuantOp)

FakeQuant operator

Description:

Fake-quantize the 'inputs' tensor of type float via float scalars min and max to 'outputs' tensor of same shape as inputs.

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
minmax ArrayAttr min-max range pair attribute
num_bits IntegerAttr 32-bit integer attribute attribute
narrow_range BoolAttr bool attribute attribute

Results:

  1. output: tensor of any type values

tfl.fill (TFL::FillOp)

Fill the tensor with given value.

Description:

Fill the tensor with given value.

Operands:

  1. dims: tensor of 32/64-bit integer values
  2. value: tensor of any type values

Attributes:

Results:

  1. res: tensor of any type values

tfl.floor_div (TFL::FloorDivOp)

Floor div operator

Description:

Element-wise floor div operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.floor_mod (TFL::FloorModOp)

Division reminder

Description:

Element-wise division reminder operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.floor (TFL::FloorOp)

Floor operator

Description:

Returns element-wise floor value of the input.

Operands:

  1. x: tensor of floating-point values

Attributes:

Results:

  1. y: tensor of floating-point values

tfl.fully_connected (TFL::FullyConnectedOp)

Fully connected op

Description:

Operands:

  1. input: tensor of 32-bit float values
  2. filter: tensor of 32-bit float values
  3. bias: tensor of 32-bit float values or none type

Attributes:

Attribute MLIR Type Description
fused_activation_function StringAttr fused activation enum attribute
weights_format StringAttr fully connected options weights format attribute
keep_num_dims BoolAttr bool attribute attribute

Results:

  1. output: tensor of 32-bit float values

tfl.gather (TFL::GatherOp)

Gather operator

Description:

Gather slices from params axis axis according to indices.

Operands:

  1. params: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer or TFLite string type values
  2. indices: tensor of 32-bit integer or 64-bit integer values

Attributes:

Attribute MLIR Type Description
axis IntegerAttr 32-bit integer attribute attribute

Results:

  1. output: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer or TFLite string type values

tfl.greater_equal (TFL::GreaterEqualOp)

Greater_equal operator

Description:

Element-wise greater_equal operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.greater (TFL::GreaterOp)

Greater operator

Description:

Element-wise greater operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.pseudo_input (TFL::InputOp)

Input pseudo operator

Description:

Takes one of the function arguments as input and returns it as result. This is a NOP and is used to attach attributes such as tensor name to function arguments.

Operands:

  1. input: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.leaky_relu (TFL::LeakyReluOp)

Leaky Relu operator

Description:

Element-wise Leaky ReLU operator x -> x >= 0 ? x : (alpha * x)

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
alpha FloatAttr 32-bit float attribute attribute

Results:

  1. output: tensor of any type values

tfl.less_equal (TFL::LessEqualOp)

Less_equal operator

Description:

Element-wise less_equal operation.

Operands:

  1. lhs: tensor of 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values
  2. rhs: tensor of 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.less (TFL::LessOp)

Less operator

Description:

Element-wise less operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.log (TFL::LogOp)

Natural logarithm operator

Description:

Performs element-wise natural logarithm operation on input.

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.log_softmax (TFL::LogSoftmaxOp)

Log softmax operator

Description:

Computes element-wise log softmax activations with the following formula

input - log(reduce_sum(exp(input), dim))

Operands:

  1. input: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.logical_and (TFL::LogicalAndOp)

Logical AND operator

Description:

Element-wise logical AND operation.

Operands:

  1. lhs: tensor of 1-bit integer values
  2. rhs: tensor of 1-bit integer values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.logical_not (TFL::LogicalNotOp)

Logical NOT operator

Description:

Element-wise logical NOT operation.

Operands:

  1. lhs: tensor of 1-bit integer values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.logical_or (TFL::LogicalOrOp)

Logical OR operator

Description:

Element-wise logical OR operation.

Operands:

  1. lhs: tensor of 1-bit integer values
  2. rhs: tensor of 1-bit integer values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.logistic (TFL::LogisticOp)

Logistic operator

Description:

Computes element-wise Sigmoid of input

Operands:

  1. x: tensor of floating-point values

Attributes:

Results:

  1. y: tensor of floating-point values

tfl.max_pool_2d (TFL::MaxPool2DOp)

Max Pool 2D op

Description:

Performs max pool 2D on input.

Inputs: inputs[0]: required: the input tensor

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
padding StringAttr padding enum attribute
stride_w IntegerAttr 32-bit integer attribute attribute
stride_h IntegerAttr 32-bit integer attribute attribute
filter_width IntegerAttr 32-bit integer attribute attribute
filter_height IntegerAttr 32-bit integer attribute attribute
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of any type values

tfl.maximum (TFL::MaximumOp)

Max operator

Description:

Element-wise max operation.

Operands:

  1. lhs: tensor of floating-point or 32/64-bit integer values
  2. rhs: tensor of floating-point or 32/64-bit integer values

Attributes:

Results:

  1. max: tensor of floating-point or 32/64-bit integer values

tfl.mean (TFL::MeanOp)

Mean operator

Description:

Computes the mean of elements across dimensions of a tensor. Reduces input_tensor along the dimensions given in axis. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keepdims is true, the reduced dimensions are retained with length 1.

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values
  2. axis: tensor of 32-bit integer or 64-bit integer values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. output: tensor of 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values

tfl.minimum (TFL::MinimumOp)

Min operator

Description:

Element-wise min operation.

Operands:

  1. lhs: tensor of floating-point or 32/64-bit integer values
  2. rhs: tensor of floating-point or 32/64-bit integer values

Attributes:

Results:

  1. min: tensor of floating-point or 32/64-bit integer values

tfl.mul (TFL::MulOp)

Multiplication operator

Description:

Element-wise multiplication operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Attribute MLIR Type Description
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of any type values

tfl.neg (TFL::NegOp)

Negation operator

Description:

Computes element-wise negation of input

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.not_equal (TFL::NotEqualOp)

Not_equal operator

Description:

Element-wise not_equal operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of 1-bit integer values

tfl.pack (TFL::PackOp)

Packs a list of tensors along a dimension into one tensor

Description:

Packs a list of values_count rank-R tensors into one rank-(R+1) tensor.

Packs the values_count tensors in values into a tensor with rank one higher than each tensor in values, by packing them along the axis dimension.

Given a list of tensors of shape (A, B, C);

if axis == 0 then the output tensor will have the shape (N, A, B, C). if axis == 1 then the output tensor will have the shape (A, N, B, C). Etc.

For example:

# 'x' is [1, 4]
# 'y' is [2, 5]
# 'z' is [3, 6]
pack([x, y, z]) => [[1, 4], [2, 5], [3, 6]]  # Pack along first dim.
pack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]]

This is the opposite of unpack.

Operands:

  1. values: tensor of 32-bit float or 8-bit integer or 16-bit integer or 32-bit integer or 64-bit integer values

Attributes:

Attribute MLIR Type Description
values_count IntegerAttr 32-bit integer attribute attribute
axis IntegerAttr 32-bit integer attribute attribute

Results:

  1. output: tensor of 32-bit float or 8-bit integer or 16-bit integer or 32-bit integer or 64-bit integer values

tfl.pad (TFL::PadOp)

Padding operator

Description:

This operation pads a input with zeros according to the paddings you specify. paddings is an integer tensor with shape [Dn, 2], where n is the rank of input. For each dimension D of input, paddings[D, 0] indicates how many zeros to add before the contents of input in that dimension, and paddings[D, 1] indicates how many zeros to add after the contents of input in that dimension.

The padded size of each dimension D of the output is:

paddings(D, 0) + input.dim_size(D) + paddings(D, 1)

For example:

# 't' is [[1, 1], [2, 2]]
# 'paddings' is [[1, 1], [2, 2]]
# rank of 't' is 2
pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
                      [0, 0, 1, 1, 0, 0]
                      [0, 0, 2, 2, 0, 0]
                      [0, 0, 0, 0, 0, 0]]

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values
  2. padding: tensor of 32/64-bit integer values

Attributes:

Results:

  1. output: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values

tfl.padv2 (TFL::PadV2Op)

Padding operator v2

Description:

This operation pads a input according to the paddings and constant_values you specify. paddings is an integer tensor with shape [Dn, 2], where n is the rank of input. For each dimension D of input, paddings[D, 0] indicates how many zeros to add before the contents of input in that dimension, and paddings[D, 1] indicates how many zeros to add after the contents of input in that dimension. constant_values is a scalar tensor of the same type as input that indicates the value to use for padding input.

The padded size of each dimension D of the output is:

paddings(D, 0) + input.dim_size(D) + paddings(D, 1)

For example:

# 't' is [[1, 1], [2, 2]]
# 'paddings' is [[1, 1], [2, 2]]
# rank of 't' is 2
pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
                      [0, 0, 1, 1, 0, 0]
                      [0, 0, 2, 2, 0, 0]
                      [0, 0, 0, 0, 0, 0]]

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values
  2. padding: tensor of 32/64-bit integer values
  3. constant_values: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values

Attributes:

Results:

  1. output: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values

tfl.pow (TFL::PowOp)

Power operator

Description:

Element-wise power operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.pseudo_qconst (TFL::QConstOp)

Quantized constant pseudo op

Description:

Represents a quantized constant value in TensorFlow Lite dialect. This is not an actual operation and it will be lowered to buffer instead. The quantization parameters are stored as a type attribute in this constant.

Operands:

Attributes:

Attribute MLIR Type Description
qtype TypeAttr Tensor type attribute attribute
value ElementsAttr constant vector/tensor attribute attribute

Results:

  1. output: tensor of any type values

tfl.quantize (TFL::QuantizeOp)

Quantize operator

Description:

Converts floating point tensors to quantized integer tensors according to the quantization parameters defined in the type attribute.

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
qtype TypeAttr Tensor type attribute attribute

Results:

  1. output: tensor of any type values

tfl.range (TFL::RangeOp)

Range operator

Description:

Returns a 1D tensor defined by a sequence from start to limit with a given delta.

Operands:

  1. start: tensor of any type values
  2. limit: tensor of any type values
  3. delta: tensor of any type values

Attributes:

Results:

  1. result: tensor of any type values

tfl.rank (TFL::RankOp)

Rank operator.

Description:

Returns the rank of a tensor.

Operands:

  1. input: tensor of any type values

Attributes:

Results:

  1. output: tensor of any integer type

tfl.reduce_max (TFL::ReduceMaxOp)

Max-reduction operator

Description:

Computes the max reduction along the specified axes

Operands:

  1. input: tensor of any type values
  2. axes: tensor of 32/64-bit integer values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. «unnamed»: tensor of any type values

tfl.reduce_min (TFL::ReduceMinOp)

Min-reduction operator

Description:

Computes the min reduction along the specified axes

Operands:

  1. input: tensor of any type values
  2. axes: tensor of 32/64-bit integer values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. «unnamed»: tensor of any type values

tfl.relu6 (TFL::Relu6Op)

Relu6 operator

Description:

Element-wise Relu6 operator x -> max(0, min(6, x))

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.relu (TFL::ReluOp)

Relu operator

Description:

Element-wise Relu operator x -> max(0, x)

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.reshape (TFL::ReshapeOp)

Reshape operator

Description:

Produces a tensor with the same values but different static shape defined by the output type.

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
new_shape Attribute derived attribute attribute

Results:

  1. output: tensor of any type values

tfl.resize_bilinear (TFL::ResizeBilinearOp)

ResizeBilinear Op

Description:

Resize images to size using bilinear interpolation.

Operands:

  1. input: tensor of 32-bit float or 32-bit integer values
  2. size: tensor of 32-bit integer values

Attributes:

Attribute MLIR Type Description
align_corners BoolAttr bool attribute attribute

Results:

  1. output: tensor of 32-bit float values

tfl.reverse_v2 (TFL::ReverseV2Op)

ReverseV2 Operator

Description:

Reverses specific dimensions of a tensor.

Given a tensor, and a int32/int64 tensor axis representing the set of dimensions of tensor to reverse. This operation reverses each dimension i for which there exists j s.t. axis[j] == i.

Args: tensor: A Tensor. Must be one of the following types: int16, int32, int64, float32 Up to 8-D.

axis: A Tensor. Must be one of the following types: int32, int64. with only 1 element which is the axis index. TODO: Add support for multiple elements.

Operands:

  1. input: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values
  2. axis: tensor of 32-bit integer or 64-bit integer values

Attributes:

Results:

  1. output: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tfl.rsqrt (TFL::RsqrtOp)

Reciprocal of square root operator

Description:

Computes element-wise reverse square root of input

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.select (TFL::SelectOp)

Select operator

Description:

Select values of 'x' if the corresponding value of 'condition' is true or the value of 'y' if false. There are valid condition input sizes:

  1. Either the same shape (in which case the select is elementwise), or
  2. condition must be Rank 1 and match over the first dimension.

Operands:

  1. condition: tensor of 1-bit integer values
  2. x: tensor of 32-bit float or 1-bit integer or 8-bit integer or 16-bit integer or 32-bit integer or 64-bit integer values
  3. y: tensor of 32-bit float or 1-bit integer or 8-bit integer or 16-bit integer or 32-bit integer or 64-bit integer values

Attributes:

Results:

  1. output: tensor of any type values

tfl.shape (TFL::ShapeOp)

Shape operator

Description:

Returns the shape of a tensor.

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
out_type Attribute derived attribute attribute

Results:

  1. output: tensor of any type values

tfl.sin (TFL::SinOp)

Sine operator

Description:

Computes element-wise Sine of input

Operands:

  1. x: tensor of floating-point values

Attributes:

Results:

  1. y: tensor of floating-point values

tfl.softmax (TFL::SoftmaxOp)

Softmax operator

Description:

Computes element-wise softmax activiations with the following formula

exp(input) / tf.reduce_sum(exp(input * beta), dim)

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
beta FloatAttr 32-bit float attribute attribute

Results:

  1. output: tensor of any type values

tfl.space_to_batch_nd (TFL::SpaceToBatchNdOp)

SpaceToBatchNd operator

Description:

This operation reshapes space dimensions into the "batch" dimension 0

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values
  2. block_shape: tensor of 32-bit integer values
  3. paddings: tensor of 32-bit integer values

Attributes:

Results:

  1. output: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

tfl.split (TFL::SplitOp)

Splits a tensor into num_split tensors along one dimension.

Description:

Splits the value tensor along split_dim into a number of sub-tensors with same shape as the original one, except for split_dim. Same as tf.Split.

Operands:

  1. split_dim: tensor of 32-bit integer values
  2. value: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

Attributes:

Attribute MLIR Type Description
num_splits IntegerAttr 32-bit integer attribute attribute

Results:

  1. outputs: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

tfl.split_v (TFL::SplitVOp)

Splits a tensor into num_split tensors along one dimension.

Description:

Splits the value tensor along split_dim into a number of sub-tensors with same shape as the original one, except for split_dim. The grouping of the resultant sub-tensors is decided by size-splits. Same as tf.SplitV.

Operands:

  1. value: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values
  2. size_splits: tensor of 32-bit integer values
  3. split_dim: tensor of 32-bit integer values

Attributes:

Attribute MLIR Type Description
num_splits IntegerAttr 32-bit integer attribute attribute

Results:

  1. outputs: tensor of 32-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

tfl.sqrt (TFL::SqrtOp)

Square root operator

Description:

Computes element-wise Square root of input

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.square (TFL::SquareOp)

Square operator

Description:

Computes element-wise Square of input

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.squared_difference (TFL::SquaredDifferenceOp)

Squared difference operator

Description:

Element-wise squared difference operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values

tfl.squeeze (TFL::SqueezeOp)

Removes dimensions of size 1 from the shape of a tensor.

Description:

Given a tensor input, this operation returns a tensor of the same type with all dimensions of size 1 removed. If you don't want to remove all size 1 dimensions, you can remove specific size 1 dimensions by specifying axis.

For example:

# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]
shape(squeeze(t)) ==> [2, 3]

Or, to remove specific size 1 dimensions:

# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]
shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1]

Operands:

  1. input: tensor of any type values

Attributes:

Attribute MLIR Type Description
squeeze_dims ArrayAttr 64-bit integer array attribute attribute

Results:

  1. output: tensor of any type values

tfl.strided_slice (TFL::StridedSliceOp)

StridedSlice Op

Description:

Return a strided slice from input.

Operands:

  1. input: tensor of 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values
  2. begin: tensor of 32-bit integer values
  3. end: tensor of 32-bit integer values
  4. strides: tensor of 32-bit integer values

Attributes:

Attribute MLIR Type Description
begin_mask IntegerAttr 32-bit integer attribute attribute
end_mask IntegerAttr 32-bit integer attribute attribute
ellipsis_mask IntegerAttr 32-bit integer attribute attribute
new_axis_mask IntegerAttr 32-bit integer attribute attribute
shrink_axis_mask IntegerAttr 32-bit integer attribute attribute

Results:

  1. output: tensor of 32-bit float or 32-bit integer or 64-bit integer or 8-bit integer values

tfl.sub (TFL::SubOp)

Subtraction operator

Description:

Element-wise subtraction operation.

Operands:

  1. lhs: tensor of any type values
  2. rhs: tensor of any type values

Attributes:

Attribute MLIR Type Description
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output: tensor of any type values

tfl.sum (TFL::SumOp)

Sum operator

Description:

Computes the sum reduction along the specified axes

Operands:

  1. input: tensor of any type values
  2. axes: tensor of 32/64-bit integer values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. «unnamed»: tensor of any type values

tfl.tanh (TFL::TanhOp)

Hyperbolic tangent operator

Description:

Computes element-wise Hyperbolic tangent of input

Operands:

  1. x: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.tile (TFL::TileOp)

Tile operator.

Description:

Constructs a tensor by tiling a given tensor.

This operation creates a new tensor by replicating input multiples times. The output tensor's i'th dimension has input.dims(i) * multiples[i] elements, and the values of input are replicated multiples[i] times along the 'i'th dimension. For example, tiling [a b c d] by [2] produces [a b c d a b c d].

Operands:

  1. input: tensor of any type values
  2. multiples: tensor of 32/64-bit integer values

Attributes:

Results:

  1. output: tensor of any type values

tfl.topk_v2 (TFL::TopKV2Op)

TopK operator

Description:

Returns the top k largest element along each last dimensional slice of input and the indices of values within the last dimension of the input tensor.

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer or 64-bit integer values
  2. k: tensor of 32-bit integer values

Attributes:

Results:

  1. values: tensor of any type values
  2. indices: tensor of 32-bit integer values

tfl.transpose (TFL::TransposeOp)

Transpose operator

Description:

Returns the Transpose of x

Operands:

  1. x: tensor of any type values
  2. perm: tensor of any type values

Attributes:

Results:

  1. y: tensor of any type values

tfl.unidirectional_sequence_lstm (TFL::UnidirectionalSequenceLSTMOp)

Unidirectional sequence lstm operator

Description:

A recurrent neural network specified by an LSTM cell. This Op supports unrolling the input along the time or batch dimensions, and implements the following operation for each element in the sequence s = 1...sequence_length: outputs[s] = state = activation(LSTMOp(inputs[s]))

where LSTMOp is LSTM TF Lite Op and the “activation” is the function passed as the “fused_activation_function” argument (if not “NONE”).

Operands:

  1. input: tensor of 32-bit float or 8-bit integer values
  2. input_to_input_weights: tensor of 32-bit float or 8-bit integer values or none type
  3. input_to_forget_weights: tensor of 32-bit float or 8-bit integer values
  4. input_to_cell_weights: tensor of 32-bit float or 8-bit integer values
  5. input_to_output_weights: tensor of 32-bit float or 8-bit integer values
  6. recurrent_to_input_weights: tensor of 32-bit float or 8-bit integer values or none type
  7. recurrent_to_forget_weights: tensor of 32-bit float or 8-bit integer values
  8. recurrent_to_cell_weights: tensor of 32-bit float or 8-bit integer values
  9. recurrent_to_output_weights: tensor of 32-bit float or 8-bit integer values
  10. cell_to_input_weights: tensor of 32-bit float or 8-bit integer values or none type
  11. cell_to_forget_weights: tensor of 32-bit float or 8-bit integer values or none type
  12. cell_to_output_weights: tensor of 32-bit float or 8-bit integer values or none type
  13. input_gate_bias: tensor of 32-bit float values or none type
  14. forget_gate_bias: tensor of 32-bit float values
  15. cell_bias: tensor of 32-bit float values
  16. output_gate_bias: tensor of 32-bit float values
  17. projection_weights: tensor of 32-bit float or 8-bit integer values or none type
  18. projection_bias: tensor of 32-bit float values or none type
  19. input_activation_state: stateful tensor
  20. input_cell_state: stateful tensor
  21. input_layer_norm_coefficients: tensor of 32-bit float or 8-bit integer values or none type
  22. forget_layer_norm_coefficients: tensor of 32-bit float or 8-bit integer values or none type
  23. cell_layer_norm_coefficients: tensor of 32-bit float or 8-bit integer values or none type
  24. output_layer_norm_coefficients: tensor of 32-bit float or 8-bit integer values or none type

Attributes:

Attribute MLIR Type Description
fused_activation_function StringAttr fused activation enum attribute
cell_clip FloatAttr 32-bit float attribute attribute
proj_clip FloatAttr 32-bit float attribute attribute
time_major BoolAttr bool attribute attribute

Results:

  1. output: tensor of any type values

tfl.unpack (TFL::UnpackOp)

Unpacks a tensor along a dimension into multiple tensors

Description:

Unpacks a given dimension of a rank-R tensor into num rank-(R-1) tensors.

Unpacks num tensors from value by chipping it along the axis dimension. For example, given a tensor of shape (A, B, C, D);

If axis == 0 then the i'th tensor in output is the slice value[i, :, :, :] and each tensor in output will have shape (B, C, D). (Note that the dimension unpacked along is gone, unlike split).

If axis == 1 then the i'th tensor in output is the slice value[:, i, :, :] and each tensor in output will have shape (A, C, D). Etc.

This is the opposite of pack.

Operands:

  1. input: tensor of 32-bit float or 8-bit integer or 32-bit integer values

Attributes:

Attribute MLIR Type Description
num IntegerAttr 32-bit integer attribute attribute
axis IntegerAttr 32-bit integer attribute attribute

Results:

  1. outputs: tensor of 32-bit float or 8-bit integer or 32-bit integer values

tfl.zeros_like (TFL::ZerosLikeOp)

ZerosLike operator

Description:

Returns a tensor of zeros with the same shape and type as the input tensor.

Operands:

  1. input: tensor of any type values

Attributes:

Results:

  1. output: tensor of any type values