| 762 | } |
| 763 | |
| 764 | Status MutableGraphView::CheckNodeNamesAndFanins( |
| 765 | const absl::flat_hash_map<absl::string_view, int>& node_names, |
| 766 | const std::vector<RenamedOrOverwrittenNode>& renamed_nodes, |
| 767 | const std::vector<int>& inplace_nodes) { |
| 768 | // Check if removed/missing node fanouts are valid. |
| 769 | TF_RETURN_IF_ERROR( |
| 770 | RemovedOrMissingNodeFanoutsWellFormed(node_names, renamed_nodes)); |
| 771 | |
| 772 | // Check if updated nodes and their fanins are valid. |
| 773 | for (auto& inplace_node : inplace_nodes) { |
| 774 | auto& diff = mutation_.updated_nodes_[inplace_node]; |
| 775 | if (!internal::IsWellFormed(&diff, node_names)) { |
| 776 | return errors::InvalidArgument( |
| 777 | kMutableGraphViewApplyError, "inplace updated node '", |
| 778 | nodes_[diff.node_index].GetName(), "' is ill-formed."); |
| 779 | } |
| 780 | } |
| 781 | for (auto& renamed_node : renamed_nodes) { |
| 782 | auto& diff = mutation_.updated_nodes_[renamed_node.renamed_update_index_]; |
| 783 | if (!internal::IsWellFormed(&diff, node_names)) { |
| 784 | return errors::InvalidArgument( |
| 785 | kMutableGraphViewApplyError, "renamed updated node '", diff.name, |
| 786 | "' ('", nodes_[diff.node_index].GetName(), "') is ill-formed."); |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | // Check if new nodes and their fanins are valid. |
| 791 | for (auto& new_node : mutation_.new_nodes_) { |
| 792 | if (!internal::IsWellFormed(&new_node, node_names)) { |
| 793 | return errors::InvalidArgument(kMutableGraphViewApplyError, "new node '", |
| 794 | new_node.node.name(), "' is ill-formed."); |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | return Status::OK(); |
| 799 | } |
| 800 | |
| 801 | Status MutableGraphView::CheckKernelRegisteredForNodes() { |
| 802 | Status s; |
nothing calls this directly
no test coverage detected