導入 ConcreteFunction 並將其轉換為文本 MLIR 模塊。
用法
tf.mlir.experimental.convert_function(
concrete_function, pass_pipeline='tf-standard-pipeline',
show_debug_info=False
)
參數
-
concrete_function
ConcreteFunction 類型的對象。 -
pass_pipeline
要在模塊上運行的 MLIR Pass Pipeline 的文本說明,請參閱 MLIR 文檔文本傳遞管道語法. -
show_debug_info
是否在發出的文本形式中包含位置。
返回
- 對應於 ConcreteFunction 的 MLIR 模塊的文本表示。
拋出
-
InvalidArgumentError
如果 concrete_function 無效或無法轉換為 MLIR。
此 API 僅用於檢查 TensorFlow 的內部,返回的字符串目前用於調試目的。
通過提取其 ConcreteFunction(圍繞 tf.Graph 的eagerly-executing 包裝器),可以使用此 API 導入 tf.function 並將其從 TensorFlow 轉換為 TensorFlow MLIR。
例如:
@tf.function
def add(a, b):
return a + b
concrete_function = add.get_concrete_function(
tf.TensorSpec(None, tf.dtypes.float32),
tf.TensorSpec(None, tf.dtypes.float32))
tf.mlir.experimental.convert_function(concrete_function)
'...module attributes {...} {...}...'
相關用法
- Python tf.math.special.fresnel_cos用法及代碼示例
- Python tf.math.polyval用法及代碼示例
- Python tf.math.is_finite用法及代碼示例
- Python tf.math.special.bessel_k0e用法及代碼示例
- Python tf.math.acosh用法及代碼示例
- Python tf.math.invert_permutation用法及代碼示例
- Python tf.math.segment_prod用法及代碼示例
- Python tf.math.bincount用法及代碼示例
- Python tf.math.bessel_i0e用法及代碼示例
- Python tf.math.unsorted_segment_min用法及代碼示例
- Python tf.math.conj用法及代碼示例
- Python tf.math.scalar_mul用法及代碼示例
- Python tf.math.zero_fraction用法及代碼示例
- Python tf.math.reduce_max用法及代碼示例
- Python tf.math.special.fresnel_sin用法及代碼示例
- Python tf.math.segment_mean用法及代碼示例
- Python tf.math.xlog1py用法及代碼示例
- Python tf.math.less_equal用法及代碼示例
- Python tf.math.reduce_min用法及代碼示例
- Python tf.math.log_sigmoid用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.mlir.experimental.convert_function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。