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

Method ExpectNodes

tensorflow/core/graph/subgraph_test.cc:67–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 bool HasNode(const string& name) { return FindNode(name) != nullptr; }
66
67 void ExpectNodes(const string& nodes) {
68 int count = 0;
69 std::vector<string> actual_nodes;
70 for (Node* n : g_->nodes()) {
71 if (n->IsOp()) {
72 count++;
73 actual_nodes.push_back(n->name());
74 }
75 }
76 std::sort(actual_nodes.begin(), actual_nodes.end());
77
78 LOG(INFO) << "Nodes present: " << absl::StrJoin(actual_nodes, " ");
79
80 std::vector<string> expected_nodes = str_util::Split(nodes, ',');
81 std::sort(expected_nodes.begin(), expected_nodes.end());
82 for (const string& s : expected_nodes) {
83 Node* n = FindNode(s);
84 EXPECT_TRUE(n != nullptr) << s;
85 if (n->type_string() == "_Send" || n->type_string() == "_Recv") {
86 EXPECT_EQ(device_info_.name(), n->assigned_device_name()) << s;
87 }
88 }
89
90 EXPECT_TRUE(actual_nodes.size() == expected_nodes.size())
91 << "\nActual: " << absl::StrJoin(actual_nodes, ",")
92 << "\nExpected: " << absl::StrJoin(expected_nodes, ",");
93 }
94
95 bool HasEdge(const string& src, int src_out, const string& dst, int dst_in) {
96 for (const Edge* e : g_->edges()) {

Callers

nothing calls this directly

Calls 9

sortFunction · 0.85
IsOpMethod · 0.80
nameMethod · 0.65
SplitFunction · 0.50
nodesMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected