Skip to content

Commit 63a113d

Browse files
fionalangtensorflower-gardener
authored andcommitted
Redirect references from control_flow_ops.cond to cond.cond.
This is to ultimately remove the circular dependencies that pass from `control_flow_ops.py` to `cond_v2.py`. PiperOrigin-RevId: 518458725
1 parent 1b40639 commit 63a113d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tensorflow_model_optimization/python/core/keras/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ py_strict_library(
4141
srcs_version = "PY3",
4242
visibility = ["//visibility:public"],
4343
deps = [
44-
# python:control_flow_ops tensorflow dep2,
44+
# tensorflow dep1,
4545
# python:smart_cond tensorflow dep2,
4646
# python:variables tensorflow dep2,
4747
],

tensorflow_model_optimization/python/core/keras/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
from __future__ import division
2323
from __future__ import print_function
2424

25+
import tensorflow as tf
26+
2527
# TODO(b/151772467): Move away from depending on private APIs.
2628
from tensorflow.python.framework import smart_cond as smart_module
27-
from tensorflow.python.ops import control_flow_ops
2829
from tensorflow.python.ops import variables
2930

3031

@@ -48,7 +49,7 @@ def smart_cond(pred, true_fn=None, false_fn=None, name=None): # pylint: disable
4849
TypeError: If `true_fn` or `false_fn` is not callable.
4950
"""
5051
if isinstance(pred, variables.Variable):
51-
return control_flow_ops.cond(
52+
return tf.cond(
5253
pred, true_fn=true_fn, false_fn=false_fn, name=name)
5354
return smart_module.smart_cond(
5455
pred, true_fn=true_fn, false_fn=false_fn, name=name)

0 commit comments

Comments
 (0)