Add IsCondSwitch.
authorJacques Pienaar <jpienaar@google.com>
Wed, 9 May 2018 20:03:45 +0000 (13:03 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 9 May 2018 20:21:02 +0000 (13:21 -0700)
commit52c26df56bd0a5244c400c2c655db388ba8b95ce
tree31fb92588342a5d035dd469a8ca686bc29b40b31
parentfa3a9bcabfea46bb3a4c63f559b50cc066d484e7
Add IsCondSwitch.

* Switch nodes are not part of the cond contexts of the tf.cond that they are the switches for, so check the contexts of the outputs of the switch to determine if a cond switch.
* Include the pivot of a cond in its cond context (there is one pivot per CondContext)
* If a cond is nested in a while loop, then the switch nodes of the cond is in the control flow context of the while loop, so only return that it is a loop switch if it isn't a cond switch.

PiperOrigin-RevId: 196015879
tensorflow/python/kernel_tests/control_flow_util_test.py
tensorflow/python/ops/control_flow_ops.py
tensorflow/python/ops/control_flow_util.py