Commit c3a9f923 authored by Tong Shen's avatar Tong Shen Committed by TensorFlower Gardener
Browse files

In FunctionalizeCond, cluster Merge nodes by (CondId, AncestorId, predicate).

Original implementation cluster Merge nodes by (CondId, AncestorId), which is not enough. For the following case:
  pred1 = array_ops.placeholder(dtypes.bool, name='pred1')
  pred2 = array_ops.placeholder(dtypes.bool, name='pred2')
  cond1 = control_flow_ops.cond(pred1, ...)
  cond2 = control_flow_ops.cond(pred2, ...)
  cond3 = control_flow_ops.cond(pred1, use cond1 and cond2)
  cond4 = control_flow_ops.cond(pred2, use cond1 and cond2)

cond3 and cond4 have the same CondId (empty) and the same AncestorId ({pred1, PRED}, {merge_of_cond1, MERGE}), but they should not be merged into one "If" node (because they have different predicates).

This does not happen before cl/231844072, because back then AncestorId uses Switch node in AncestorId, and cond3/cond4 has different Switch nodes.

PiperOrigin-RevId: 232931242
parent 243118bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment