| 1530 | } |
| 1531 | |
| 1532 | void TestGradientsSuccess(bool grad_inputs_provided) { |
| 1533 | TF_Output inputs[2]; |
| 1534 | TF_Output outputs[1]; |
| 1535 | TF_Output grad_outputs[2]; |
| 1536 | TF_Output expected_grad_outputs[2]; |
| 1537 | |
| 1538 | BuildSuccessGraph(inputs, outputs); |
| 1539 | BuildExpectedGraph(grad_inputs_provided, expected_grad_outputs); |
| 1540 | |
| 1541 | AddGradients(grad_inputs_provided, nullptr, inputs, 2, outputs, 1, |
| 1542 | grad_outputs); |
| 1543 | EXPECT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 1544 | |
| 1545 | // Compare that the graphs match. |
| 1546 | GraphDef expected_gdef; |
| 1547 | GraphDef gdef; |
| 1548 | EXPECT_TRUE(GetGraphDef(expected_graph_, &expected_gdef)); |
| 1549 | EXPECT_TRUE(GetGraphDef(graph_, &gdef)); |
| 1550 | TF_EXPECT_GRAPH_EQ(expected_gdef, gdef); |
| 1551 | |
| 1552 | // Compare that the output of the gradients of both graphs match. |
| 1553 | RunGraphsAndCompareOutputs(grad_outputs, expected_grad_outputs); |
| 1554 | } |
| 1555 | |
| 1556 | void TestGradientsError(bool grad_inputs_provided) { |
| 1557 | TF_Output inputs[1]; |
nothing calls this directly
no test coverage detected