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

Function TEST

tensorflow/compiler/tf2xla/resource_util_test.cc:84–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82} // anonymous namespace
83
84TEST(ResourceOpAnalyzerTest, SingleResourceSingleUserNoPassThrough) {
85 FunctionLibraryDefinition flib_def(OpRegistry::Global(),
86 FunctionDefLibrary());
87 GraphDefBuilder builder(GraphDefBuilder::kFailImmediately, &flib_def);
88 auto opts = builder.opts();
89 auto op_reg = opts.op_registry();
90
91 {
92 /*
93 * stack_size -> stack_op -> stack_close
94 */
95 NodeBuilder stack_size_placeholder_builder("stack_size", "Placeholder",
96 op_reg);
97 stack_size_placeholder_builder.Attr("dtype", DT_INT32);
98 Node* stack_size_placeholder =
99 opts.FinalizeBuilder(&stack_size_placeholder_builder);
100
101 NodeBuilder stack_op_builder("stack_op", "StackV2", op_reg);
102 stack_op_builder.Input(stack_size_placeholder).Attr("elem_type", DT_FLOAT);
103 Node* stack_op = opts.FinalizeBuilder(&stack_op_builder);
104
105 NodeBuilder stack_close_builder("stack_close", "StackCloseV2", op_reg);
106 stack_close_builder.Input(stack_op);
107 opts.FinalizeBuilder(&stack_close_builder);
108 }
109
110 GraphDef graphdef;
111 TF_EXPECT_OK(builder.ToGraphDef(&graphdef));
112
113 absl::flat_hash_map<std::string, absl::flat_hash_set<std::string>> expected;
114 expected[":stack_op:StackV2"] =
115 absl::flat_hash_set<std::string>({":stack_close:StackCloseV2"});
116 AnalyzeAndVerify(graphdef, &flib_def, expected);
117}
118
119TEST(ResourceOpAnalyzerTest, SingleResourceSingleUserWithPassThrough) {
120 FunctionLibraryDefinition flib_def(OpRegistry::Global(),

Callers

nothing calls this directly

Calls 7

AnalyzeAndVerifyFunction · 0.85
FinalizeBuilderMethod · 0.80
op_registryMethod · 0.45
AttrMethod · 0.45
InputMethod · 0.45
ToGraphDefMethod · 0.45
add_functionMethod · 0.45

Tested by

no test coverage detected