Cond context manager that disable containing nodes if predicate is False.
tfx.v1.dsl.Cond(
predicate: placeholder.Predicate
)
Cond blocks can be nested to express the nested conditions.
Usage | |
---|---|
evaluator = Evaluator(
examples=example_gen.outputs['examples'],
model=trainer.outputs['model'],
eval_config=EvalConfig(...))
with Cond(evaluator.outputs['blessing'].future() .custom_property('blessed') == 1): pusher = Pusher( model=trainer.outputs['model'], push_destination=PushDestination(...)) |
Methods
create_context
create_context() -> CondContext
Creates an underlying DslContext object.
All nodes defined within this DslContextManager would be associated with the created DslContext.
Since DslContextManager can enter multiple times and each represents a different context, the return value should be newly created (not reused).
Returns | |
---|---|
Newly created DslContext object. |
enter
enter(
context: CondContext
) -> None
Subclass hook method for enter.
Returned value is captured at "with..as" clause. It can be any helper object to augment DSL syntax.
Args | |
---|---|
context
|
Newly created DslContext that DslContextManager has created for the enter(). |
__enter__
__enter__() -> _Handle
__exit__
__exit__(
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[types.TracebackType]
)