| 431 | void Graph::set_versions(const VersionDef& versions) { *versions_ = versions; } |
| 432 | |
| 433 | Node* Graph::AddNode(NodeDef node_def, Status* status) { |
| 434 | const OpDef* op_def; |
| 435 | status->Update(ops_.LookUpOpDef(node_def.op(), &op_def)); |
| 436 | if (!status->ok()) return nullptr; |
| 437 | |
| 438 | DataTypeVector inputs; |
| 439 | DataTypeVector outputs; |
| 440 | status->Update(InOutTypesForNode(node_def, *op_def, &inputs, &outputs)); |
| 441 | if (!status->ok()) { |
| 442 | *status = AttachDef(*status, node_def); |
| 443 | return nullptr; |
| 444 | } |
| 445 | |
| 446 | Node* node = AllocateNode(std::make_shared<NodeProperties>( |
| 447 | op_def, std::move(node_def), inputs, outputs), |
| 448 | nullptr); |
| 449 | return node; |
| 450 | } |
| 451 | |
| 452 | Node* Graph::CopyNode(const Node* node) { |
| 453 | DCHECK(!node->IsSource()); |