此页面由 Cloud Translation API 翻译。
Switch to English

方言'定义

TensorFlow Lite方言。

该方言映射到TensorFlow Lite操作。

不变量:

  • 所有值均为Tensor类型(特别是,标量使用零维张量表示);

操作定义

tfl.abs(TFL :: AbsOp)

绝对值运算符

描述:

给定张量x ,此操作将返回一个张量,其中包含x中每个元素的绝对值。例如,如果x是输入元素,而y是输出元素,则此运算将计算\(y = | x | \)。

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.add_n(TFL :: AddNOp)

add_n运算符

描述:

将所有输入张量按元素相加。

操作数:

  1. inputs :任何类型值的张量

属性:

结果:

  1. sum :任何类型值的张量

tfl.add(TFL :: AddOp)

加法运算符

描述:

逐元素加法运算。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.arg_max(TFL :: ArgMaxOp)

ArgMax运算子

描述:

返回张量维度上具有最大值的索引。

操作数:

  1. input :任何类型值的张量
  2. dim :任何类型的张量值

属性:

属性 MLIR类型描述
output_type Attribute 派生属性

结果:

  1. output :任何类型值的张量

tfl.arg_min(TFL :: ArgMinOp)

ArgMin运算符

描述:

返回在张量的维度上具有最小值的索引。” a = [1、10、26.9、2.8、166.32、62.3] b = tf.math.argmin(input = a)c = tf.keras.backend.eval (b)

操作数:

  1. input :任何类型值的张量
  2. dim :任何类型的张量值

属性:

属性 MLIR类型描述
output_type Attribute 派生属性

结果:

  1. output :任何类型值的张量

tfl.average_pool_2d(TFL :: AveragePool2DOp)

Average_pool_2d运算符

描述:

对输入执行平均池化操作。

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
filter_height IntegerAttr 32位整数属性
filter_width IntegerAttr 32位整数属性
padding StringAttr 填充枚举属性
stride_h IntegerAttr 32位整数属性
stride_w IntegerAttr 32位整数属性
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.basic_lstm(TFL :: BasicLSTMOp)

基本的lstm运算符

描述:

基本的LSTM单元运算符。

操作数:

  1. data_input :任何类型值的张量
  2. prev_activ_input :任何类型值的张量
  3. weights_input :任何类型值的张量
  4. biases_input :任何类型值的张量
  5. prev_state_input :任何类型值的张量

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性
cell_clip FloatAttr 32位浮点属性
proj_clip FloatAttr 32位浮点属性
kernel_type StringAttr lstm内核类型枚举大小写BASIC属性

结果:

  1. activ_output :任何类型值的2D张量
  2. state_output :任何类型值的2D张量
  3. concat_temp :任何类型值的2D张量
  4. activ_temp :任何类型值的2D张量

tfl.batch_to_space_nd(TFL :: BatchToSpaceNdOp)

BatchToSpaceNd运算符

描述:

此操作将“批”尺寸0整形为空间尺寸。

操作数:

  1. input :任何类型值的张量
  2. block_shape :任何类型值的张量
  3. indices :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.cast(TFL :: CastOp)

演员

描述:

将输入从输入类型转换为输出类型。

操作数:

  1. input :任何类型值的张量

属性:

结果:

  1. output :任何类型值的张量

tfl.ceil(TFL :: CeilOp)

Ceil运算符

描述:

返回输入的逐元素ceil值。

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.concatenation(TFL :: ConcatenationOp)

串联运算符

描述:

沿一维连接张量

操作数:

  1. values :任何类型的张量值

属性:

属性 MLIR类型描述
axis IntegerAttr 32位整数属性
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.pseudo_const(TFL :: ConstOp)

常量伪运算。

描述:

在TensorFlow Lite方言中表示一个常数值。这不是实际操作,它将降低为缓冲。

允许op具有与tf.Const相同的所有类型的属性(例如,允许不透明的TF属性)。

操作数:

属性:

属性 MLIR类型描述
value ElementsAttr 常数向量/张量属性

结果:

  1. output :任何类型值的张量

tfl.conv_2d(TFL :: Conv2DOp)

卷积算子

描述:

对输入执行卷积运算。

输入: inputs[0] :必需:输入激活张量inputs[1] :必需:过滤器重量张量inputs[2] :可选:偏置张量

操作数:

  1. input :任何类型值的张量
  2. filter :任何类型的张量值
  3. bias :任何类型值或无类型的张量

属性:

属性 MLIR类型描述
dilation_h_factor IntegerAttr 32位整数属性
dilation_w_factor IntegerAttr 32位整数属性
fused_activation_function StringAttr 融合激活枚举属性
padding StringAttr 填充枚举属性
stride_h IntegerAttr 32位整数属性
stride_w IntegerAttr 32位整数属性

结果:

  1. output :任何类型值的张量

tfl.convolution_2d_transpose_bias(TFL :: Convolution2DTransposeBiasOp)

用偏置算子转置卷积

描述:

在输入上执行转置卷积运算,可以选择添加偏置。请注意,这是标准运行时中不支持的自定义操作。

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

操作数:

  1. input :任何类型值的张量
  2. filter :任何类型的张量值
  3. bias :任何类型值或无类型的张量

属性:

属性 MLIR类型描述
padding StringAttr 填充枚举属性
stride_h IntegerAttr 32位整数属性
stride_w IntegerAttr 32位整数属性

结果:

  1. output :任何类型值的张量

tfl.cos(TFL :: CosOp)

余弦运算符

描述:

计算输入的按元素余弦

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.densify(TFL :: DensifyOp)

密集运算符

描述:

将稀疏张量转换为密集格式。

操作数:

  1. input :任何类型值的张量

属性:

结果:

  1. output :任何类型值的张量

tfl.depth_to_space(TFL :: DepthToSpaceOp)

DepthToSpace运算符

描述:

将数据从深度重新排列为空间数据块。这是SpaceToDepth的反向转换。更具体地说,此op输出输入张量的副本,其中depth尺寸的值在空间块中移动到height尺寸和width尺寸。 attr block_size指示输入块的大小以及如何移动数据。

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
block_size IntegerAttr 32位整数属性

结果:

  1. output :任何类型值的张量

tfl.depthwise_conv_2d(TFL :: DepthwiseConv2DOp)

深度可分卷积算子

描述:

对输入执行卷积运算。

输入: inputs[0] :必需:输入激活张量inputs[1] :必需:过滤器重量张量inputs[2] :可选:偏置张量

操作数:

  1. input :任何类型值的张量
  2. filter :任何类型的张量值
  3. bias :任何类型值或无类型的张量

属性:

属性 MLIR类型描述
dilation_h_factor IntegerAttr 32位整数属性
dilation_w_factor IntegerAttr 32位整数属性
fused_activation_function StringAttr 融合激活枚举属性
padding StringAttr 填充枚举属性
stride_h IntegerAttr 32位整数属性
stride_w IntegerAttr 32位整数属性
depth_multiplier IntegerAttr 32位整数属性

结果:

  1. output :任何类型值的张量

tfl.dequantize(TFL :: DequantizeOp)

消除运营商

描述:

根据量化参数将量化的整数数组转换为浮点数。

操作数:

  1. input :任何类型值的张量

属性:

结果:

  1. output :任何类型值的张量

tfl.div(TFL :: DivOp)

部门运营商

描述:

按元素划分操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.elu(TFL :: EluOp)

指数线性单位算子

描述:

对于x <0,计算指数线性f(x)-> exp(x)-1,对于x> = 0,计算x。按元素进行计算。

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.embedding_lookup(TFL :: EmbeddingLookupOp)

嵌入查找运算符

描述:

在嵌入张量列表中查找id。

操作数:

  1. lookup :任何类型的张量值
  2. value :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.equal(TFL :: EqualOp)

平等算子

描述:

返回x == y逐元素的true元素

操作数:

  1. x :任何类型的张量值
  2. y :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.exp(TFL :: ExpOp)

自然幂运算符

描述:

对输入执行逐元素自然幂运算。

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.expand_dims(TFL :: ExpandDimsOp)

将1的尺寸插入张量的形状。

描述:

给定张量input ,此操作会在input形状的尺寸索引axis插入尺寸1。尺寸索引axis从零开始;如果axis指定负数,则从末尾算起。

如果要将批次尺寸添加到单个元素,此操作很有用。例如,如果您有一个形状为[height, width, channels] ,则可以使用expand_dims(image, 0)使其成为1张图像的批处理,这将使形状为[1, height, width, channels]

其他例子:

 # '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]
 

此操作要求:

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

此操作与squeeze() ,后者会删除尺寸为1的尺寸。

操作数:

  1. input :任何类型值的张量
  2. dim :任何整数类型的张量

属性:

结果:

  1. output :任何类型值的张量

tfl.external_const(TFL :: ExternalConstOp)

外部常量操作。

描述:

外部const op包含一个buffer_index ,它指向buffer_index中的一个常量。

操作数:

属性:

属性 MLIR类型描述
buffer_index IntegerAttr 32位整数属性

结果:

  1. output :任何类型值的张量

tfl.fake_quant(TFL :: FakeQuantOp)

FakeQuant运算符

描述:

将float类型的min和max的float类型的“输入”张量进行伪量化,使其形状与输入形状相同。

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
min FloatAttr 32位浮点属性
max FloatAttr 32位浮点属性
num_bits IntegerAttr 32位整数属性
narrow_range BoolAttr 布尔属性

结果:

  1. output :任何类型值的张量

tfl.fill(TFL :: FillOp)

用给定值填充张量。

描述:

用给定值填充张量。

操作数:

  1. dims :任何类型的张量值
  2. value :任何类型的张量值

属性:

结果:

  1. res :任何类型的张量值

tfl.floor_div(TFL :: FloorDivOp)

楼层div运算符

描述:

按元素进行div分区操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.floor_mod(TFL :: FloorModOp)

分区提醒

描述:

按元素划分提醒操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.floor(TFL :: FloorOp)

楼层操作员

描述:

返回输入的逐元素底值。

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.fully_connected(TFL :: FullyConnectedOp)

全连接运维

描述:

操作数:

  1. input :任何类型值的张量
  2. filter :任何类型的张量值
  3. bias :任何类型值或无类型的张量

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性
weights_format StringAttr 完全连接的选项权重格式属性
keep_num_dims BoolAttr 布尔属性

结果:

  1. output :任何类型值的张量

tfl.gather_nd(TFL :: GatherNdOp)

Gather_nd运算子

描述:

params切片到张量的张量,其形状由indices指定。

操作数:

  1. params :任何类型的张量值
  2. indices :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.gather(TFL :: GatherOp)

集合运算符

描述:

从收集切片paramsaxis根据indices

操作数:

  1. params :任何类型的张量值
  2. indices :任何类型的张量值

属性:

属性 MLIR类型描述
axis IntegerAttr 32位整数属性

结果:

  1. output :任何类型值的张量

tfl.greater_equal(TFL :: GreaterEqualOp)

大于等于运算符

描述:

逐元素的Greater_Equal操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.greater(TFL :: GreaterOp)

更大的运营商

描述:

逐元素进行更大的操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.hard_swish(TFL :: HardSwishOp)

辛苦的激活功能。

描述:

按元素计算硬激活函数f(x)->(x * relu6(x + 3))/ 6。

操作数:

  1. input :任何类型值的张量

属性:

结果:

  1. out :任何类型的张量值

tfl.l2_normalization(TFL :: L2NormalizationOp)

L2归一化运算符

描述:

L2规格化运算

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.lstm(TFL :: LSTMOp)

完整的lstm运算符

描述:

长短期存储单元(LSTM)循环网络层。默认的非猫眼实施方式基于:http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf S. Hochreiter和J. Schmidhuber。 “长期短期记忆”。 Neural Computation,9(8):1735-1780,1997年。窥孔实现基于:https://research.google.com/pubs/archive/43905.pdf Hasim Sak,Andrew Senior和Francoise Beaufays。 “用于大规模声学建模的长短期记忆递归神经网络架构。INTERSPEECH,2014年。输入和忘记门的耦合(CIFG)基于:http://arxiv.org/pdf/1503.04069.pdf Greff等人。“ LSTM:搜索空间漫游”层归一化基于:https://arxiv.org/pdf/1607.06450.pdf Ba等人“层归一化”

操作数:

  1. input :任何类型值的张量
  2. input_to_input_weights :任何类型值或无类型的张量
  3. input_to_forget_weights :任何类型值的张量
  4. input_to_cell_weights :任何类型值的张量
  5. input_to_output_weights :任何类型值的张量
  6. recurrent_to_input_weights :任何类型值或无类型的张量
  7. recurrent_to_forget_weights :任何类型值的张量
  8. recurrent_to_cell_weights :任何类型值的张量
  9. recurrent_to_output_weights :任何类型值的张量
  10. cell_to_input_weights :任何类型值或无类型的张量
  11. cell_to_forget_weights :任何类型值或无类型的张量
  12. cell_to_output_weights :任何类型值或无类型的张量
  13. input_gate_bias :任何类型值或无类型的张量
  14. forget_gate_bias :任何类型值的张量
  15. cell_bias :任何类型值的张量
  16. output_gate_bias :任何类型值的张量
  17. projection_weights :任何类型值或无类型的张量
  18. projection_bias :任何类型值或无类型的张量
  19. input_activation_state :有状态张量
  20. input_cell_state :有状态张量
  21. input_layer_norm_coefficients :任何类型值或无类型的张量
  22. forget_layer_norm_coefficients :任何类型值或无类型的张量
  23. cell_layer_norm_coefficients :任何类型值或无类型的张量
  24. output_layer_norm_coefficients :任何类型值或无类型的张量

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性
cell_clip FloatAttr 32位浮点属性
proj_clip FloatAttr 32位浮点属性
kernel_type StringAttr lstm内核类型枚举大小写FULL属性

结果:

  1. output :任何类型值的张量

tfl.leaky_relu(TFL :: LeakyReluOp)

泄漏的Relu运算符

描述:

按元素泄漏LeLU运算符x-> x> = 0? x:(alpha * x)

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
alpha FloatAttr 32位浮点属性

结果:

  1. output :任何类型值的张量

tfl.less_equal(TFL :: LessEqualOp)

Less_equal运算符

描述:

逐元素的less_equal操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.less(TFL :: LessOp)

更少的运算符

描述:

逐元素减少操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.local_response_normalization(TFL :: LocalResponseNormalizationOp)

本地响应规范化。

描述:

将4-D input张量视为一维矢量的3-D数组(沿最后一个维度),并且每个矢量都独立进行归一化。在给定的向量内,每个分量除以depth_radius内输入的加权平方和。详细地,

 sqr_sum[a, b, c, d] =
    sum(input[a, b, c, d - depth_radius : d + depth_radius + 1] ** 2)
output = input / (bias + alpha * sqr_sum) ** beta
 

有关详细信息,请参见Krizhevsky等人的《具有深度卷积神经网络的ImageNet分类》(NIPS 2012)

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
radius IntegerAttr 32位整数属性
bias FloatAttr 32位浮点属性
alpha FloatAttr 32位浮点属性
beta FloatAttr 32位浮点属性

结果:

  1. output :任何类型值的张量

tfl.log(TFL :: LogOp)

自然对数运算符

描述:

对输入执行逐元素自然对数运算。

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.log_softmax(TFL :: LogSoftmaxOp)

记录softmax运算符

描述:

使用以下公式计算逐元素对数softmax激活

输入-日志(reduce_sum(exp(input),dim))

操作数:

  1. input :任何类型值的张量

属性:

结果:

  1. output :任何类型值的张量

tfl.logical_and(TFL :: LogicalAndOp)

逻辑AND运算子

描述:

按元素进行逻辑与运算。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.logical_not(TFL :: LogicalNotOp)

逻辑非运算符

描述:

按元素进行逻辑非运算。

操作数:

  1. lhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.logical_or(TFL :: LogicalOrOp)

逻辑或运算符

描述:

按元素进行逻辑或运算。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.logistic(TFL :: LogisticOp)

物流运营商

描述:

计算输入的按元素Sigmoid

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.matrix_diag(TFL :: MatrixDiagOp)

 Returns a tensor with the provided diagonal and everything else padded with zeros.
 

描述:

给定对角线,则返回带有对角线的张量,其他所有内容都填充零。假设对角线具有k个维度[I, J, K, ..., N] ,则输出为等级为k+1的张量,维度为[I, J, K, ..., N, N]其中: output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n].

操作数:

  1. diagonal :任何类型的张量值

属性:

结果:

  1. output :任何类型值的张量

tfl.matrix_set_diag(TFL :: MatrixSetDiagOp)

 Returns a batched matrix tensor with new batched diagonal values.
 

描述:

给定inputdiagonal ,此操作将返回张量,其形状和值与input相同,但最内层矩阵的主对角线除外。这些将被diagonal的值覆盖。

操作数:

  1. input :32位浮点数或32位整数或64位整数或8位整数或QI8类型或QI16类型或QUI8类型或TFLite uint8类型或TFLite quint8类型值的张量
  2. diagonal :32位浮点数或32位整数或64位整数或8位整数或QI8类型或QI16类型或QUI8类型或TFLite uint8类型或TFLite quint8类型值的张量

属性:

结果:

  1. output :32位浮点数或32位整数或64位整数或8位整数或QI8类型或QI16类型或QUI8类型或TFLite uint8类型或TFLite quint8类型值的张量

tfl.max_pool_2d(TFL :: MaxPool2DOp)

Max Pool 2D op

描述:

对输入执行最大池2D。

输入: inputs[0] :必需:输入张量

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
padding StringAttr 填充枚举属性
stride_w IntegerAttr 32位整数属性
stride_h IntegerAttr 32位整数属性
filter_width IntegerAttr 32位整数属性
filter_height IntegerAttr 32位整数属性
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.max_pooling_with_argmax_2d(TFL :: MaxPoolingWithArgMax2DOp)

带有argmax op的Max Pool 2D

描述:

对输入执行最大池化,并输出最大值和索引。每个索引都是“ filter_w” x“ filter_h”大小的子数组中的扁平索引。请注意,这是标准运行时中不支持的自定义操作。

输入: inputs[0] :必需:输入激活张量

操作数:

  1. input :任何类型值的张量

属性:

属性 MLIR类型描述
padding StringAttr 填充枚举属性
stride_w IntegerAttr 32位整数属性
stride_h IntegerAttr 32位整数属性
filter_w IntegerAttr 32位整数属性
filter_h IntegerAttr 32位整数属性

结果:

  1. value :任何类型的张量值
  2. indices :任何类型的张量值

tfl.max_unpooling_2d(TFL :: MaxUnpooling2DOp)

Max Unpool 2D

描述:

执行最大卸载操作。在某种程度上,这是最大池化的相反操作:输入激活张量中的元素存储在输入索引指定的位置。请注意,这是标准运行时中不支持的自定义操作。

输入: inputs[0] :必填:输入激活张量inputs[1] :必填:输入索引

操作数:

  1. input :任何类型值的张量
  2. indices :任何类型的张量值

属性:

属性 MLIR类型描述
padding StringAttr 填充枚举属性
stride_w IntegerAttr 32位整数属性
stride_h IntegerAttr 32位整数属性
filter_w IntegerAttr 32位整数属性
filter_h IntegerAttr 32位整数属性

结果:

  1. outputs :任何类型值的张量

tfl.maximum(TFL :: MaximumOp)

最大运算符

描述:

逐元素最大操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. max :任何类型的张量值

tfl.mean(TFL :: MeanOp)

平均算子

描述:

计算跨张量维度的元素的均值。沿轴上给定的尺寸减小input_tensor。除非keepdims为true,否则对于轴上的每个条目,张量的秩都会减小1。如果keepdims为true,则缩小的尺寸将保留为长度1。

操作数:

  1. input :任何类型值的张量
  2. axis :任何类型的张量值

属性:

属性 MLIR类型描述
keep_dims BoolAttr 布尔属性

结果:

  1. output :任何类型值的张量

tfl.minimum(TFL :: MinimumOp)

最小运算符

描述:

逐元素最小操作。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

结果:

  1. min :任何类型的张量值

tfl.mirror_pad(TFL :: MirrorPadOp)

MirrorPad运算​​符。用镜像值填充张量。

描述:

此操作根据您指定的填充用镜像值填充输入。 paddings是形状为[n,2]的整数张量,其中n是输入的秩。对于输入的每个维D,paddings [D,0]指示在该维中输入内容之前要添加多少值,而paddings [D,1]指示在该维输入内容之后要添加多少值。

如果copy_border为true(分别为false),则paddings [D,0]和paddings [D,1]都不得大于input.dim_size(D)(或input.dim_size(D)-1)。

输出的每个维度D的填充大小为:

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

操作数:

  1. input :任何类型值的张量
  2. pad :任何类型的张量值

属性:

属性 MLIR类型描述
mode StringAttr 镜垫枚举属性

结果:

  1. output :任何类型值的张量

tfl.mul(TFL :: MulOp)

乘法运算符

描述:

逐元素乘法运算。

操作数:

  1. lhs :任何类型的张量值
  2. rhs :任何类型的张量值

属性:

属性 MLIR类型描述
fused_activation_function StringAttr 融合激活枚举属性

结果:

  1. output :任何类型值的张量

tfl.neg(TFL :: NegOp)

求反运算符

描述:

计算输入的按元素取反

操作数:

  1. x :任何类型的张量值

属性:

结果:

  1. y :任何类型的张量值

tfl.non_max_suppression_v4(TFL :: NonMaxSuppressionV4Op)

贪婪地按照分数的降序选择边界框的子集,

描述:

修剪掉具有较高交叉点重叠(IOU)的框与先前选择的框重叠。分数小于score_threshold边界框score_threshold被删除。提供的边界框为[y1,x1,y2,x2],其中(y1,x1)和(y2,x2)是对角线的任何对角线的角,坐标可以按归一化的方式提供(即,位于间隔[0,1])或绝对值。请注意,该算法与原点位于坐标系中的位置无关,并且更一般而言,它对于坐标系的正交变换和平移不变。因此,坐标系的平移或反射会导致算法选择相同的框。此操作的输出是一组整数,这些整数索引到表示所选框的边界框的输入集合中。然后可以使用tf.gather operation获得与所选索引对应的边界框坐标。例如:selected_indices = tf.image.non_max_suppression_v2(框,分数,max_output_size,iou_threshold,score_threshold)selected_boxes = tf.gather(框,selected_indices)

操作数:

  1. boxes :任何类型的张量值
  2. scores :任何类型的张量值
  3. max_output_size :任何类型值的张量
  4. iou_threshold :任何类型值的张量
  5. score_threshold :任何类型值的张量

属性:

结果:

  1. selected_indices :任何类型值的张量
  2. valid_outputs :任何类型值的张量

tfl.non_max_suppression_v5(TFL :: NonMaxSuppressionV5Op)

贪婪地按照分数的降序选择边界框的子集,

描述:

修剪掉具有较高交叉点重叠(IOU)的框与先前选择的框重叠。分数小于score_threshold边界框score_threshold被删除。边界框以[y1,x1,y2,x2]的形式提供,其中(y1,x1)和(y2,x2)是任何对角线对角线的角,坐标可以按归一化的方式提供(即,位于间隔[0,1])或绝对值。请注意,该算法与原点位于坐标系中的位置无关,并且更一般而言,它对于坐标系的正交变换和平移不变。因此,坐标系的平移或反射会导致算法选择相同的框。此操作的输出是一组整数,这些整数索引到表示所选框的边界框的输入集合中。然后可以使用tf.gather operation获得与所选索引对应的边界框坐标。 For example: selected_indices = tf.image.non_max_suppression_v2( boxes, scores, max_output_size, iou_threshold, score_threshold) selected_boxes = tf.gather(boxes, selected_indices) This op also supports a Soft-NMS (with Gaussian weighting) mode (cf Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score of other overlapping boxes instead of directly causing them to be pruned. To enable this Soft-NMS mode, set the soft_nms_sigma parameter to be larger than 0.

Operands:

  1. boxes : tensor of any type values
  2. scores : tensor of any type values
  3. max_output_size : tensor of any type values
  4. iou_threshold : tensor of any type values
  5. score_threshold : tensor of any type values
  6. soft_nms_sigma : tensor of any type values

Attributes:

Results:

  1. selected_indices : tensor of any type values
  2. selected_scores : tensor of any type values
  3. valid_outputs : 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 any type values

tfl.NumericVerify (TFL::NumericVerifyOp)

Verifies the numericals of the two operands

Description:

The NumericVerify op is a debugging op to verify the numericals of the two activations. It is a custom op in TFLite.

Operands:

  1. input : tensor of any type values
  2. ref : tensor of any type values

Attributes:

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

Results:

tfl.one_hot (TFL::OneHotOp)

OneHot operator

Description:

Returns a one-hot tensor.The locations represented by indices in indices take value on_value , while all other locations take value off_value .

If the input indices is rank N , the output will have rank N+1 , The new axis is created at dimension axis (default: the new axis is appended at the end).

Operands:

  1. indices : tensor of any type values
  2. depth : tensor of any type values
  3. on_value : tensor of any type values
  4. off_value : tensor of any type values

Attributes:

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

Results:

  1. output : tensor of any type values

tfl.prelu (TFL::PReluOp)

Parameterized Relu operator

Description:

Parameterized Relu operator x -> x >= 0 ? x : (alpha * x) where alpha is a trainable tensor. alpha should have one less rank than the input as it doesn't have the batch dimension, and the other dimensions either should be the same size as input or size 1, where it is broadcasted in the second case.

Operands:

  1. input : tensor of any type values
  2. alpha : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type 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 any type 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 any type 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 any type values
  2. padding : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type 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 any type values
  2. padding : tensor of any type values
  3. constant_values : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type 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_any (TFL::ReduceAnyOp)

Computes the "logical or" of elements across dimensions of a tensor.

Description:

Reduces input along the dimensions given in axis . Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis . If keep_dims is true, the reduced dimensions are retained with length 1.

Operands:

  1. input : tensor of any type values
  2. reduction_indices : tensor of any type values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. output : tensor of any type values

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 any type 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 any type values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. «unnamed»: tensor of any type values

tfl.reduce_prod (TFL::ReduceProdOp)

Prod-reduction operator

Description:

Computes the product along the specified axes

Operands:

  1. input : tensor of any type values
  2. axes : tensor of any type values

Attributes:

Attribute MLIR Type Description
keep_dims BoolAttr bool attribute attribute

Results:

  1. «unnamed»: tensor of any type values

tfl.relu_n1_to_1 (TFL::Relu1Op)

Relu1 operator

Description:

Element-wise Relu1 operator x -> max(-1, min(1, x))

Operands:

  1. x : tensor of any type values

Attributes:

Results:

  1. y : 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
  2. shape : tensor of any type values

Attributes:

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 any type values
  2. size : tensor of any type values

Attributes:

Attribute MLIR Type Description
align_corners BoolAttr bool attribute attribute
half_pixel_centers BoolAttr bool attribute attribute

Results:

  1. output : tensor of any type values

tfl.resize_nearest_neighbor (TFL::ResizeNearestNeighborOp)

ResizeNearestNeighbor Op

Description:

Resize images to size using nearest neighbor interpolation.

Operands:

  1. input : tensor of any type values
  2. size : tensor of any type values

Attributes:

Attribute MLIR Type Description
align_corners BoolAttr bool attribute attribute

Results:

  1. output : tensor of any type values

tfl.reverse_sequence (TFL::ReverseSequenceOp)

Reverses variable length slices.

Description:

This op first slices input along the dimension batch_dim , and for each slice i , reverses the first seq_lengths[i] elements along the dimension seq_dim .

The elements of seq_lengths must obey seq_lengths[i] <= input.dims[seq_dim] , and seq_lengths must be a vector of length input.dims[batch_dim] .

The output slice i along dimension batch_dim is then given by input slice i , with the first seq_lengths[i] slices along dimension seq_dim reversed.

Operands:

  1. input : tensor of any type values
  2. seq_lengths : tensor of any type values

Attributes:

Attribute MLIR Type Description
seq_dim IntegerAttr 32-bit integer attribute attribute
batch_dim IntegerAttr 32-bit integer attribute attribute

Results:

  1. output : tensor of any type 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 st axis[j] == i.

Args: tensor: A Tensor. Must be one of the following types: uint8, int16, int32, int64, float32, bool 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 any type values
  2. axis : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type values

tfl.round (TFL::RoundOp)

Round operator

Description:

Rounds the values of a tensor to the nearest integer, element-wise.

Operands:

  1. x : tensor of any type values

Attributes:

Results:

  1. y : tensor of any type 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.svdf (TFL::SVDFOp)

Single value decomposition filter operator

Description:

The SVDF op is a decomposition of a densely connected op into low rank filters. For details: https://research.google.com/pubs/pub43813.html https://arxiv.org/abs/1812.02802

Operands:

  1. input : tensor of any type values
  2. feature_weights : tensor of any type values
  3. time_weights : tensor of any type values
  4. input_gate_bias : tensor of any type values or none type
  5. activation_state : stateful tensor

Attributes:

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

Results:

  1. output : tensor of any type values

tfl.segment_sum (TFL::SegmentSumOp)

SegmentSum operator

Description:

Computes the sum along segments of a tensor.

Operands:

  1. data : tensor of any type values
  2. segment_ids : tensor of any type values

Attributes:

Results:

  1. output : 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 any type values
  2. x : tensor of any type values
  3. y : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type values

tfl.select_v2 (TFL::SelectV2Op)

SelectV2 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. Broadcastable shapes between 'condition', 'x' and 'y'.

Operands:

  1. condition : tensor of any type values
  2. x : tensor of any type values
  3. y : tensor of any type 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 any type values

Attributes:

Results:

  1. y : tensor of any type values

tfl.slice (TFL::SliceOp)

Return a slice from 'input'.

Description:

The output tensor is a tensor with dimensions described by 'size' whose values are extracted from 'input' starting at the offsets in 'begin'.

begin is zero-based; size is one-based. If size[i] is -1, all remaining elements in dimension i are included in the slice. In other words, this is equivalent to setting: size[i] = input.dim_size(i) - begin[i]

Requirements : 0 <= begin[i] <= begin[i] + size[i] <= Di for i in [0, n)

Operands:

  1. input : tensor of any type values
  2. begin : tensor of any type values
  3. size : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type values

tfl.softmax (TFL::SoftmaxOp)

Softmax operator

Description:

Computes element-wise softmax activations 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 any type values
  2. block_shape : tensor of any type values
  3. paddings : tensor of any type values

Attributes:

Results:

  1. output : tensor of any type values

tfl.space_to_depth (TFL::SpaceToDepthOp)

SpaceToDepth operator

Description:

Rearranges blocks of spatial data, into depth. More specifically, this op outputs a copy of the input tensor where values from the height and width dimensions are moved to the depth dimension. block_size indicates the input block size.

Operands:

  1. input : tensor of any type values

Attributes:

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

Results:

  1. output : tensor of any type values

tfl.pseudo_sparse_const (TFL::SparseConstOp)

Sparse constant pseudo op.

Description:

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

Operands:

Attributes:

Attribute MLIR Type Description
value ElementsAttr constant vector/tensor attribute attribute
s_param TFL::SparsityParameterAttr Sparsity parameter. attribute

Results:

  1. output : tensor of any type values

tfl.pseudo_sparse_qconst (TFL::SparseQConstOp)

Sparse quantized constant pseudo op

Description:

Represents a sparse 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
s_param TFL::SparsityParameterAttr Sparsity parameter. attribute

Results:

  1. output : tensor of any type values

tfl.sparse_to_dense (TFL::SparseToDenseOp)

Converts a sparse representation into a dense tensor.

Description:

Builds an array dense with shape output_shape such that

 # If sparse_indices is scalar
dense[i] = (i == sparse_indices ? sparse_values : default_value)

# If sparse_indices is a vector, then for each i
dense[sparse_indices[i]] = sparse_values[i]

# If sparse_indices is an n by d matrix, then for each i in [0, n)
dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i]
 

All other values in dense are set to default_value . If sparse_values is a scalar, all sparse indices are set to this single value.

Indices should be sorted in lexicographic order, and indices must not contain any repeats. If validate_indices is true, these properties are checked during execution.

Operands:

  1. sparse_indices : tensor of any type values
  2. output_shape : tensor of any type values
  3. sparse_values : tensor of any type values
  4. default_value : tensor of any type values

Attributes:

Results:

  1. dense : tensor of any type 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 any type values
  2. value : tensor of any type values

Attributes:

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

Results:

  1. outputs : tensor of any type 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 any type values
  2. size_splits : 1D tensor of 32-bit integer values
  3. split_dim : 0D tensor of 32-bit integer values

Attributes:

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

Results:

  1. outputs : tensor of any type 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 any type values
  2. begin : tensor of any type values
  3. end : tensor of any type values
  4. strides : tensor of any type 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 any type 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 any type 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 [abcd] by [2] produces [abcdabcd].

Operands:

  1. input : tensor of any type values
  2. multiples : tensor of any type 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 any type values
  2. k : tensor of any type values

Attributes:

Results:

  1. values : tensor of any type values
  2. indices : tensor of any type values

tfl.transpose_conv (TFL::TransposeConvOp)

Transpose convolution operator

Description:

Performs transpose convolution operation on input.

Operands:

  1. output_shape : 1D tensor of any type values
  2. weights : tensor of any type values
  3. input : tensor of any type values

Attributes:

Attribute MLIR Type Description
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.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 any type values
  2. input_to_input_weights : tensor of any type values or none type
  3. input_to_forget_weights : tensor of any type values
  4. input_to_cell_weights : tensor of any type values
  5. input_to_output_weights : tensor of any type values
  6. recurrent_to_input_weights : tensor of any type values or none type
  7. recurrent_to_forget_weights : tensor of any type values
  8. recurrent_to_cell_weights : tensor of any type values
  9. recurrent_to_output_weights : tensor of any type values
  10. cell_to_input_weights : tensor of any type values or none type
  11. cell_to_forget_weights : tensor of any type values or none type
  12. cell_to_output_weights : tensor of any type values or none type
  13. input_gate_bias : tensor of any type values or none type
  14. forget_gate_bias : tensor of any type values
  15. cell_bias : tensor of any type values
  16. output_gate_bias : tensor of any type values
  17. projection_weights : tensor of any type values or none type
  18. projection_bias : tensor of any type values or none type
  19. input_activation_state : stateful tensor
  20. input_cell_state : stateful tensor
  21. input_layer_norm_coefficients : tensor of any type values or none type
  22. forget_layer_norm_coefficients : tensor of any type values or none type
  23. cell_layer_norm_coefficients : tensor of any type values or none type
  24. output_layer_norm_coefficients : tensor of any type 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.unidirectional_sequence_rnn (TFL::UnidirectionalSequenceRNNOp)

Unidirectional sequence rnn operator

Description:

A recurrent neural network specified by an RNN cell. This Op takes in input in a format {batch_size, seq_len, input_size} or {seq_len, batch_size, input_size} if it's time-majored.

It implements the following operation for each element in the sequence s = 1...sequence_length: outputs[s] = state = activation(RNNOp(inputs[s]))

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

Operands:

  1. input : tensor of any type values
  2. input_to_input_weights : tensor of any type values
  3. recurrent_to_input_weights : tensor of any type values
  4. input_gate_bias : tensor of any type values
  5. hidden_state : stateful tensor

Attributes:

Attribute MLIR Type Description
time_major BoolAttr bool attribute attribute
fused_activation_function StringAttr fused activation enum attribute

Results:

  1. output : tensor of any type values

tfl.unique (TFL::UniqueOp)

Unique Op.

Description:

This operation returns a tensor y containing all of the unique elements of x sorted in the same order that they occur in x . This operation also returns a tensor idx the same size as x that contains the index of each value of x in the unique output y . In other words:

Operands:

  1. input : tensor of any type values

Attributes:

Attribute MLIR Type Description
idx_out_type Attribute derived attribute attribute

Results:

  1. output : tensor of any type values
  2. idx : 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 any type 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 any type values

tfl.where (TFL::WhereOp)

Returns locations of nonzero / true values in a tensor.

Description:

This operation returns the coordinates of true elements in condition . The coordinates are returned in a 2-D tensor where the first dimension (rows) represents the number of true elements, and the second dimension (columns) represents the coordinates of the true elements. Keep in mind, the shape of the output tensor can vary depending on how many true values there are in condition . Indices are output in row-major order.

Operands:

  1. input : tensor of any type values

Attributes:

Results:

  1. index : tensor of any type values

tfl.while (TFL::WhileOp)

While loop

Description:

output = input; while (cond(output)) { output = body(output) }

While loop where all values are passes through arguments with implicit capture.

input: A list of input tensors whose types are T. output: A list of output tensors whose types are T. cond: A region takes 'input' and returns a boolean scalar tensor. body: A region that takes a list of tensors and returns another list of tensors. Both lists have the same types.

Operands:

  1. input : tensor of any type values

Attributes:

Attribute MLIR Type Description
is_stateless BoolAttr bool attribute attribute

Results:

  1. output : tensor of any type values

tfl.yield (TFL::YieldOp)

Yield operation

Description:

The "yield" operation represents a return operation within the conditional and body of structured control flow (eg, while). The operation takes variable number of operands and produces no results. The operand number and types must match the signature of the region that contains the operation.

Operands:

  1. operands : any type

Attributes:

Results:

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