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

Method TestGradientsSuccess

tensorflow/c/c_api_test.cc:1532–1554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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];

Callers

nothing calls this directly

Calls 3

TF_GetCodeFunction · 0.85
TF_MessageFunction · 0.85
GetGraphDefFunction · 0.85

Tested by

no test coverage detected