[Tensorflow Metrics] Add tracking for enable_control_flow() and disable_control_flow() usage.
PiperOrigin-RevId: 304501441 Change-Id: Ic4107d97db6c93d35ac4eb7257d24f62af3cd012
This commit is contained in:
parent
4455956ce8
commit
09f552a0c2
@ -91,7 +91,9 @@ _USE_C_SHAPES = True
|
||||
_api_usage_gauge = monitoring.BoolGauge(
|
||||
"/tensorflow/api/ops_eager_execution",
|
||||
"Whether ops.enable_eager_execution() is called.")
|
||||
|
||||
_control_flow_api_gauge = monitoring.BoolGauge(
|
||||
"/tensorflow/api/enable_control_flow_v2",
|
||||
"Whether enable_control_flow_v2() is called.")
|
||||
|
||||
# pylint: disable=protected-access
|
||||
_DTYPES_INTERN_TABLE = dtypes._INTERN_TABLE
|
||||
|
@ -42,6 +42,8 @@ def enable_control_flow_v2(): # pylint: disable=invalid-name
|
||||
Note: v2 control flow is always enabled inside of tf.function. Calling this
|
||||
function is not required.
|
||||
"""
|
||||
# pylint: disable=protected-access
|
||||
ops._control_flow_api_gauge.get_cell().set(True)
|
||||
control_flow_util.ENABLE_CONTROL_FLOW_V2 = True
|
||||
|
||||
|
||||
@ -55,6 +57,8 @@ def disable_control_flow_v2(): # pylint: disable=invalid-name
|
||||
If your code needs tf.disable_control_flow_v2() to be called to work
|
||||
properly please file a bug.
|
||||
"""
|
||||
# pylint: disable=protected-access
|
||||
ops._control_flow_api_gauge.get_cell().set(False)
|
||||
control_flow_util.ENABLE_CONTROL_FLOW_V2 = False
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user