()
| 950 | # TODO(b/138808492): Remove code inside copybara |
| 951 | # to make TPU code and CPU code consistent. |
| 952 | def _enclosing_tpu_context(): |
| 953 | # pylint: disable=protected-access |
| 954 | run_context = ops.get_default_graph()._get_control_flow_context() |
| 955 | # pylint: enable=protected-access |
| 956 | while run_context is not None and not isinstance( |
| 957 | run_context, control_flow_ops.XLAControlFlowContext): |
| 958 | run_context = run_context.outer_context |
| 959 | return run_context |
| 960 | |
| 961 | |
| 962 | # copybara:strip_end |
no test coverage detected