| 456 | } // namespace |
| 457 | |
| 458 | MutableGraphView::MutableGraphView(GraphDef* graph, Status* status) |
| 459 | : GraphViewInternal(graph), mutation_(Mutation(this)) { |
| 460 | const int num_nodes = graph->node_size(); |
| 461 | node_index_by_name_.reserve(num_nodes); |
| 462 | nodes_.reserve(num_nodes); |
| 463 | for (NodeDef& node : *graph->mutable_node()) { |
| 464 | if (!AddUniqueNodeInternal(&node)) { |
| 465 | *status = errors::InvalidArgument( |
| 466 | kMutableGraphViewError, "graph has multiple nodes with the name '", |
| 467 | node.name(), "'."); |
| 468 | Reset(); |
| 469 | return; |
| 470 | } |
| 471 | } |
| 472 | std::vector<std::vector<TensorId>> fanins; |
| 473 | Status s = CheckFaninsInternal(&fanins); |
| 474 | if (!s.ok()) { |
| 475 | *status = s; |
| 476 | Reset(); |
| 477 | return; |
| 478 | } |
| 479 | AddFaninsInternal(&fanins); |
| 480 | mutation_.ResetInternal(); |
| 481 | *status = Status::OK(); |
| 482 | } |
| 483 | |
| 484 | Mutation* MutableGraphView::GetMutationBuilder() { return &mutation_; } |
| 485 |
nothing calls this directly
no test coverage detected