| 374 | // Graph |
| 375 | |
| 376 | Graph::Graph(const OpRegistryInterface* ops) |
| 377 | : ops_(ops, FunctionDefLibrary()), |
| 378 | versions_(new VersionDef), |
| 379 | arena_(8 << 10 /* 8kB */) { |
| 380 | versions_->set_producer(TF_GRAPH_DEF_VERSION); |
| 381 | versions_->set_min_consumer(TF_GRAPH_DEF_VERSION_MIN_CONSUMER); |
| 382 | |
| 383 | // Initialize the name interning table for assigned_device_name. |
| 384 | device_names_.push_back(""); |
| 385 | DCHECK_EQ(0, InternDeviceName("")); |
| 386 | |
| 387 | // Source and sink have no endpoints, just control edges. |
| 388 | NodeDef def; |
| 389 | def.set_name("_SOURCE"); |
| 390 | def.set_op("NoOp"); |
| 391 | Status status; |
| 392 | Node* source = AddNode(def, &status); |
| 393 | TF_CHECK_OK(status); |
| 394 | CHECK_EQ(source->id(), kSourceId); |
| 395 | |
| 396 | def.set_name("_SINK"); |
| 397 | Node* sink = AddNode(def, &status); |
| 398 | TF_CHECK_OK(status); |
| 399 | CHECK_EQ(sink->id(), kSinkId); |
| 400 | |
| 401 | AddControlEdge(source, sink); |
| 402 | } |
| 403 | |
| 404 | Graph::Graph(const FunctionLibraryDefinition& flib_def) |
| 405 | : Graph(flib_def.default_registry()) { |