| 138 | } |
| 139 | |
| 140 | TEST_F(ExecutorTest, SimpleAdd) { |
| 141 | // c = a + b |
| 142 | auto g = absl::make_unique<Graph>(OpRegistry::Global()); |
| 143 | auto in0 = test::graph::Arg(g.get(), 0, DT_FLOAT); |
| 144 | auto in1 = test::graph::Arg(g.get(), 0, DT_FLOAT); |
| 145 | auto tmp = test::graph::Add(g.get(), in0, in1); |
| 146 | test::graph::Retval(g.get(), 0, tmp); |
| 147 | FixupSourceAndSinkEdges(g.get()); |
| 148 | Create(std::move(g)); |
| 149 | FunctionCallFrame call_frame({DT_FLOAT, DT_FLOAT}, {DT_FLOAT}); |
| 150 | TF_ASSERT_OK(call_frame.SetArgs({V(1.0), V(1.0)})); |
| 151 | TF_ASSERT_OK(Run(&call_frame)); |
| 152 | std::vector<Tensor> retvals; |
| 153 | TF_ASSERT_OK(call_frame.ConsumeRetvals(&retvals, false)); |
| 154 | EXPECT_EQ(2.0, V(retvals[0])); // out = 1.0 + 1.0 = 2.0 |
| 155 | } |
| 156 | |
| 157 | TEST_F(ExecutorTest, SelfAdd) { |
| 158 | // v0 <- a |
nothing calls this directly
no test coverage detected