Commit c14e3f26 authored by Jacques Pienaar's avatar Jacques Pienaar Committed by TensorFlower Gardener
Browse files

Combine determining conditional clusters and flow forward.

* Redo functionalizing cond nodes by combining the cluster identification and flow forward parts.
* Propagate the predicates that must hold for a node to execute to handle cases with redundant switch/merge nodes.
  - Predicates are now stored explicitly as an array (CondState);
* Each node has one CondId associated with its execution, this id represents a unique CondState;
* Introduce a merge and dead state to ensure correct behavior for one conditional feeding into another and for redundant switch nodes (i.e., switch on predicate p while already on a then/else branch of predicate p);
  - The support for dead nodes is limited to case introduced by gradient code;
* Add Conditional class that represents a If that will be extracted;
* Extract branches reachable from Merge nodes;
  - If the output of a switch does not feed into a merge, then that switch will be pruned - this is inline with expectation/while behavior;
  - Extracting from the Merge nodes up can result in a switch node being shared between different Conditionals;
  - Replicating constants also supported as workaround;

PiperOrigin-RevId: 209202945
parent 5198cb8b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment