| 106 | } |
| 107 | |
| 108 | static Node* AddIdentity(StringPiece name, Graph* g, Endpoint input) { |
| 109 | DCHECK_LT(0, input.dtype()); |
| 110 | NodeDef ndef; |
| 111 | ndef.set_name(g->NewName(absl::StrCat(kNodeLabel, "/", name))); |
| 112 | ndef.set_op("Identity"); |
| 113 | ndef.add_input(input.name()); |
| 114 | AddNodeAttr("T", BaseType(input.dtype()), &ndef); |
| 115 | Status s; |
| 116 | Node* ret = g->AddNode(ndef, &s); |
| 117 | TF_CHECK_OK(s); |
| 118 | g->AddEdge(input.node, input.index, ret, 0); |
| 119 | return ret; |
| 120 | } |
| 121 | |
| 122 | static Node* AddArg(Graph* g, DataType dtype, int index) { |
| 123 | DCHECK_LT(0, dtype); |