| 128 | } |
| 129 | |
| 130 | Status CondBuilder::CreatePivotNodes() { |
| 131 | // Construct the basic cond body (consisting of feeding in the predicate to |
| 132 | // create pivot nodes). |
| 133 | Node* switch_pred; |
| 134 | TF_RETURN_IF_ERROR(NodeBuilder(NewName("switch_pred"), "Switch", |
| 135 | graph_->op_registry(), &debug_info_) |
| 136 | .Input(NodeOut(pred_)) |
| 137 | .Input(NodeOut(pred_)) |
| 138 | .Device(if_op_->requested_device()) |
| 139 | .Finalize(graph_, &switch_pred)); |
| 140 | control_predecessor_ = switch_pred; |
| 141 | TF_RETURN_IF_ERROR(NodeBuilder(NewName("pivot_f"), "Identity", |
| 142 | graph_->op_registry(), &debug_info_) |
| 143 | .Input(switch_pred, kElseBranch) |
| 144 | .Device(if_op_->requested_device()) |
| 145 | .Finalize(graph_, &pivot_f_)); |
| 146 | TF_RETURN_IF_ERROR(NodeBuilder(NewName("pivot_t"), "Identity", |
| 147 | graph_->op_registry(), &debug_info_) |
| 148 | .Input(switch_pred, kThenBranch) |
| 149 | .Device(if_op_->requested_device()) |
| 150 | .Finalize(graph_, &pivot_t_)); |
| 151 | return Status::OK(); |
| 152 | } |
| 153 | |
| 154 | string CondBuilder::NewName(const string& infix) { |
| 155 | return graph_->NewName(strings::StrCat(name_, "/", infix)); |
no test coverage detected