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

Function enable_control_flow_v2

tensorflow/python/framework/test_util.py:440–464  ·  view source on GitHub ↗

Decorator for enabling CondV2 and WhileV2 on a test. Note this enables using CondV2 and WhileV2 after running the test class's setup/teardown methods. In addition to this, callers must import the while_v2 module in order to set the _while_v2 module in control_flow_ops. Args: fn: the

(fn)

Source from the content-addressed store, hash-verified

438
439
440def enable_control_flow_v2(fn):
441 """Decorator for enabling CondV2 and WhileV2 on a test.
442
443 Note this enables using CondV2 and WhileV2 after running the test class's
444 setup/teardown methods.
445
446 In addition to this, callers must import the while_v2 module in order to set
447 the _while_v2 module in control_flow_ops.
448
449 Args:
450 fn: the function to be wrapped
451
452 Returns:
453 The wrapped function
454 """
455
456 def wrapper(*args, **kwargs):
457 enable_control_flow_v2_old = control_flow_util.ENABLE_CONTROL_FLOW_V2
458 control_flow_util.ENABLE_CONTROL_FLOW_V2 = True
459 try:
460 return fn(*args, **kwargs)
461 finally:
462 control_flow_util.ENABLE_CONTROL_FLOW_V2 = enable_control_flow_v2_old
463
464 return wrapper
465
466
467def with_control_flow_v2(cls):

Callers 1

with_control_flow_v2Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected