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

Function TEST

tensorflow/core/graph/control_flow_test.cc:48–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48TEST(ValidateControlFlowTest, InputsFromDifferentFrames) {
49 Scope scope = Scope::NewRootScope().ExitOnError();
50 std::vector<Output> inputs;
51 inputs.push_back(ops::Placeholder(scope, DT_INT32));
52 std::vector<Output> outputs;
53 TF_ASSERT_OK(ops::BuildWhileLoop(scope.NewSubScope("outer"), inputs,
54 LessThanTenCond, NestedLoopBody,
55 "outer_loop", &outputs));
56 std::unique_ptr<Graph> graph(new Graph(OpRegistry::Global()));
57 TF_ASSERT_OK(scope.ToGraph(graph.get()));
58 // {inner/Enter', 'outer/Switch'} --> 'inner/Merge'. 'inner/Enter' is in frame
59 // 'inner_loop'. 'outer/Switch' is in frame 'outer_loop'.
60 std::vector<ControlFlowInfo> info;
61 Status status = BuildControlFlowInfo(graph.get(), &info);
62 EXPECT_FALSE(status.ok());
63 EXPECT_TRUE(absl::StrContains(status.error_message(),
64 "has inputs from different frames"))
65 << status.error_message();
66 EXPECT_TRUE(absl::StrContains(status.error_message(),
67 "{{node outer/body/inner/Merge}}"))
68 << status.error_message();
69 EXPECT_TRUE(absl::StrContains(status.error_message(),
70 "{{node outer/body/inner/Enter}}"))
71 << status.error_message();
72 EXPECT_TRUE(
73 absl::StrContains(status.error_message(), "{{node outer/Switch}}"))
74 << status.error_message();
75}
76
77TEST(ValidateControlFlowTest, MismatchedParentFrames) {
78 Scope scope = Scope::NewRootScope().ExitOnError();

Callers

nothing calls this directly

Calls 15

BuildWhileLoopFunction · 0.85
BuildControlFlowInfoFunction · 0.85
ExitOnErrorMethod · 0.80
NewSubScopeMethod · 0.80
ToGraphMethod · 0.80
op_nodesMethod · 0.80
set_opMethod · 0.80
IsEnterFunction · 0.70
PlaceholderFunction · 0.50
StrContainsFunction · 0.50
push_backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected