MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetContainingCondContext

Function GetContainingCondContext

tensorflow/python/ops/control_flow_util.py:232–247  ·  view source on GitHub ↗

Returns the first ancestor CondContext of `ctxt`. Returns `ctxt` if `ctxt` is a CondContext, or None if `ctxt` is not in a cond. Args: ctxt: ControlFlowContext Returns: `ctxt` if `ctxt` is a CondContext, the most nested CondContext containing `ctxt`, or None if `ctxt` is not in

(ctxt)

Source from the content-addressed store, hash-verified

230
231
232def GetContainingCondContext(ctxt):
233 """Returns the first ancestor CondContext of `ctxt`.
234
235 Returns `ctxt` if `ctxt` is a CondContext, or None if `ctxt` is not in a cond.
236
237 Args:
238 ctxt: ControlFlowContext
239
240 Returns:
241 `ctxt` if `ctxt` is a CondContext, the most nested CondContext containing
242 `ctxt`, or None if `ctxt` is not in a cond.
243 """
244 while ctxt:
245 if ctxt.IsCondContext(): return ctxt
246 ctxt = ctxt.outer_context
247 return None
248
249
250def IsContainingContext(ctxt, maybe_containing_ctxt):

Callers 1

IsInCondFunction · 0.85

Calls 1

IsCondContextMethod · 0.45

Tested by

no test coverage detected