MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ColocateNodeToGroup

Method ColocateNodeToGroup

tensorflow/core/common_runtime/colocation_graph.cc:857–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857Status ColocationGraph::ColocateNodeToGroup(
858 std::unordered_map<StringPiece, const Node*, StringPieceHasher>*
859 colocation_group_root,
860 const Node* node, StringPiece colocation_group) {
861 const Node*& root_node = (*colocation_group_root)[colocation_group];
862 if (root_node == nullptr) {
863 // This is the first node of the colocation group, so
864 // designate this node as the 'root' of that colocation group.
865 root_node = node;
866 } else {
867 // Try to colocate the node with the root. If there is an
868 // error, return it.
869 Status s = ColocateNodes(*node, *root_node);
870 if (!s.ok()) {
871 if (!allow_soft_placement_) {
872 return AttachDef(s, *node);
873 }
874 if (log_device_placement_) {
875 LOG(INFO) << "Ignoring request to colocate node '" << node->name()
876 << "' with nodes in colocation group '" << colocation_group
877 << "' because soft placement is on and an attempt at doing "
878 "so resulted in the following error: "
879 << AttachDef(s, *node).ToString();
880 }
881 }
882 }
883 return Status::OK();
884}
885
886// Merge the (possibly disjoint) sets containing nodes "x" and
887// "y". Returns OK if the all nodes in the union of these sets can

Callers

nothing calls this directly

Calls 4

AttachDefFunction · 0.85
nameMethod · 0.65
okMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected