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

Function AnalyzeAndVerify

tensorflow/compiler/tf2xla/resource_util_test.cc:49–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void AnalyzeAndVerify(
50 const GraphDef& graphdef, FunctionLibraryDefinition* flib_def,
51 const absl::flat_hash_map<std::string, absl::flat_hash_set<std::string>>&
52 expected) {
53 auto graph = absl::make_unique<Graph>(flib_def);
54 TF_EXPECT_OK(
55 ConvertGraphDefToGraph(GraphConstructorOptions(), graphdef, graph.get()));
56
57 auto pflr = absl::make_unique<ProcessFunctionLibraryRuntime>(
58 nullptr, Env::Default(), TF_GRAPH_DEF_VERSION, flib_def,
59 OptimizerOptions());
60 FunctionLibraryRuntime* lib_runtime =
61 pflr->GetFLR(ProcessFunctionLibraryRuntime::kDefaultFLRDevice);
62 absl::flat_hash_map<ResourceUsageAnalysis::NodeInfo,
63 absl::flat_hash_set<ResourceUsageAnalysis::NodeInfo>>
64 source_to_path;
65 TF_EXPECT_OK(ResourceUsageAnalysis::Analyze(graph.get(), lib_runtime,
66 &source_to_path));
67
68 absl::flat_hash_map<ResourceUsageAnalysis::NodeInfo,
69 absl::flat_hash_set<ResourceUsageAnalysis::NodeInfo>>
70 expected_source_to_path;
71 for (auto it : expected) {
72 auto src_node_info = node_info_from_string(it.first);
73 for (const std::string& user : it.second) {
74 expected_source_to_path[src_node_info].emplace(
75 node_info_from_string(user));
76 }
77 }
78
79 EXPECT_EQ(source_to_path, expected_source_to_path);
80}
81
82} // anonymous namespace
83

Callers 1

TESTFunction · 0.85

Calls 7

ConvertGraphDefToGraphFunction · 0.85
DefaultFunction · 0.85
node_info_from_stringFunction · 0.85
GetFLRMethod · 0.80
getMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected