From 2cdd6cfac57cd0c3a71989f971112247b2532cd3 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 17 Dec 2020 18:28:15 -0800 Subject: [PATCH] Op documentation update. update of g3doc/tf_ops.md update of g3doc/includes/tf_passes.md PiperOrigin-RevId: 348130050 Change-Id: I75a1e19967d7af7f7a90ffbee82b364320788589 --- .../compiler/mlir/g3doc/includes/tf_passes.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tensorflow/compiler/mlir/g3doc/includes/tf_passes.md b/tensorflow/compiler/mlir/g3doc/includes/tf_passes.md index 40d59bba9c4..a344655a324 100644 --- a/tensorflow/compiler/mlir/g3doc/includes/tf_passes.md +++ b/tensorflow/compiler/mlir/g3doc/includes/tf_passes.md @@ -1,4 +1,34 @@ +### `-tf-device-constant-sinking`: Sinks constants implicitly captured in a tf_device.cluster region. +This pass sinks implicitly captured constants (`tf.Const` ops) used by and into +a `tf_device.cluster` region. Performing this prior to outlining will reduce the +number of arguments of the outlined function. + +For example, the following: + +```mlir +func @cluster() -> tensor { + %const = "tf.Const"() {value = dense<0> : tensor} : () -> tensor + %cluster = "tf_device.cluster"() ( { + %identity = "tf.Identity"(%const) : (tensor) -> tensor + tf_device.return %identity : tensor + }) : () -> (tensor) + return %cluster : tensor +} +``` + +will be transformed into: + +```mlir +func @cluster() -> tensor { + %cluster = "tf_device.cluster"() ( { + %const = "tf.Const"() {value = dense<0> : tensor} : () -> tensor + %identity = "tf.Identity"(%const) : (tensor) -> tensor + tf_device.return %identity : tensor + }) : () -> (tensor) + return %cluster : tensor +} +``` ### `-tf-executor-graph-pruning`: Prunes unreachable ops in a tf_executor.graph This pass removes ops from a `tf_executor.graph` that are not transitively, via data or control dependencies, connected to the associated `tf_executor.fetch`