本頁面由 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張量視為1-D向量的3D數組(沿最後一個維度),並且每個向量都獨立進行歸一化。在給定的向量內,每個分量除以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