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

Function TEST_F

tensorflow/compiler/tf2xla/functionalize_cond_test.cc:67–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65namespace {
66
67TEST_F(FunctionalizeCondTest, JoinCondStates) {
68 Tensor pred_tensor(DT_BOOL, TensorShape());
69 pred_tensor.flat<bool>().setZero();
70 Node* pred = test::graph::Constant(graph_.get(), pred_tensor, "pred");
71 Tensor val_tensor(DT_INT32, TensorShape());
72 val_tensor.flat<int>().setZero();
73 Node* val = test::graph::Constant(graph_.get(), val_tensor, "val");
74 Node* m = test::graph::Merge(graph_.get(), val, val);
75
76 StateMap::CondId then_branch;
77 {
78 StateMap::CondState ss;
79 ss.insert(std::make_pair(OutputTensor(pred, 0), BranchType::kThenBranch));
80 then_branch = GetUniqueId(ss);
81 }
82 StateMap::CondId else_branch;
83 {
84 StateMap::CondState ss;
85 ss.insert(std::make_pair(OutputTensor(pred, 0), BranchType::kElseBranch));
86 else_branch = GetUniqueId(ss);
87 }
88
89 // An non-merge op with inputs from then and else branch.
90 Status status = JoinCondStatesNonMerge(then_branch, else_branch).status();
91 EXPECT_TRUE(errors::IsInvalidArgument(status));
92
93 // Merge between then and else branch.
94 auto joined_or = JoinCondStatesMerge(m, then_branch, else_branch);
95 TF_EXPECT_OK(joined_or.status());
96 StateMap::CondId joined = joined_or.ValueOrDie();
97
98 // Merge between then branch and both branch.
99 auto t = JoinCondStatesNonMerge(then_branch, joined);
100 // Note: this is OK in terms of constraint predication, but
101 TF_EXPECT_OK(t.status());
102}
103
104TEST_F(FunctionalizeCondTest, JoinCondStatesMergeWithInputNotInCondContext) {
105 Tensor val_tensor(DT_INT32, TensorShape());

Callers

nothing calls this directly

Calls 9

GetUniqueIdFunction · 0.85
TensorShapeClass · 0.50
ConstantFunction · 0.50
MergeFunction · 0.50
OutputTensorClass · 0.50
getMethod · 0.45
insertMethod · 0.45
statusMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected