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

Function TEST_F

tensorflow/cc/framework/gradients_test.cc:87–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85//
86
87TEST_F(GradientsTest, OneMatMul) {
88 for (const bool expected : {false, true}) {
89 const Scope& scope = expected ? scope_expected_ : scope_test_;
90 // Construct forward graph.
91 auto x = Const(scope, {{1.0, 2.0}, {3.0, 4.0}});
92 auto y = Const(scope, {{1.0, 0.0}, {0.0, 1.0}});
93 auto z = MatMul(scope, x, y);
94 TF_ASSERT_OK(scope.status());
95 CHECK_NOTNULL(z.node());
96
97 if (expected) {
98 // Construct backward graph.
99 auto dz = Const(scope, {{1.0, 1.0}, {1.0, 1.0}});
100 auto dx = MatMul(scope, dz, y, MatMul::TransposeB(true));
101 auto dy = MatMul(scope, x, dz, MatMul::TransposeA(true));
102 } else {
103 // Call AddSymbolicGradients.
104 auto dz = Const(scope, {{1.0, 1.0}, {1.0, 1.0}});
105 std::vector<Output> grad_outputs;
106 TF_ASSERT_OK(
107 AddSymbolicGradients(scope, {z}, {x, y}, {dz}, &grad_outputs));
108 }
109 }
110 CompareTestAndExpectedGraphs();
111}
112
113TEST_F(GradientsTest, OneMatMul_InferGradInputs) {
114 for (const bool expected : {false, true}) {

Callers

nothing calls this directly

Calls 15

OnesLikeFunction · 0.85
StackClass · 0.85
GetTensorsFunction · 0.85
WithOpNameMethod · 0.80
AddSymbolicGradientsFunction · 0.70
ConstFunction · 0.50
MatMulFunction · 0.50
IdentityFunction · 0.50
VariableClass · 0.50
AssignFunction · 0.50
PlaceholderFunction · 0.50
SquareFunction · 0.50

Tested by

no test coverage detected