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

Function TEST

tensorflow/core/graph/graph_partition_test.cc:799–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797}
798
799TEST(TopologicalSortNodesWithTimePriorityTest, NoDependencies) {
800 // Create placeholders, shuffle them so the order in the graph is not strictly
801 // increasing.
802 Scope root = Scope::NewRootScope().ExitOnError();
803 std::vector<int> indexes;
804 for (int i = 0; i < 20; ++i) {
805 indexes.push_back((i + 2001) % 20);
806 }
807 std::vector<ops::Placeholder> placeholders;
808 for (int i : indexes) {
809 placeholders.emplace_back(root.WithOpName(strings::StrCat("p", i)),
810 DT_FLOAT);
811 placeholders.back().node()->AddAttr("_start_time", i + 1);
812 }
813
814 GraphDef gdef;
815 TF_EXPECT_OK(root.ToGraphDef(&gdef));
816
817 std::vector<std::pair<const NodeDef*, int64>> nodes;
818 std::unordered_map<const NodeDef*, int64> node_to_start_time;
819 TF_CHECK_OK(
820 TopologicalSortNodesWithTimePriority(&gdef, &nodes, &node_to_start_time));
821 ASSERT_EQ(nodes.size(), 20);
822 for (int i = 0; i < nodes.size(); ++i) {
823 EXPECT_EQ(strings::StrCat("p", i), nodes[i].first->name());
824 EXPECT_EQ(i + 1, nodes[i].second);
825 }
826}
827
828TEST(TopologicalSortNodesWithTimePriority, Dependencies) {
829 // Create placeholders, shuffle them so the order in the graph is not strictly

Callers

nothing calls this directly

Calls 15

ExitOnErrorMethod · 0.80
WithOpNameMethod · 0.80
AddAttrMethod · 0.80
NewSubScopeMethod · 0.80
nameMethod · 0.65
StrCatFunction · 0.50
AddNFunction · 0.50
PlaceholderFunction · 0.50
ConstFunction · 0.50
push_backMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected