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

Method testGradients

tensorflow/python/ops/gradients_test.py:66–77  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

64class GradientsTest(test_util.TensorFlowTestCase, parameterized.TestCase):
65
66 def testGradients(self):
67 with ops.Graph().as_default():
68 inp = constant(1.0, shape=[32, 100], name="in")
69 w = constant(1.0, shape=[100, 10], name="w")
70 b = constant(1.0, shape=[10], name="b")
71 xw = math_ops.matmul(inp, w, name="xw")
72 h = bias_add(xw, b, name="h")
73 w_grad = gradients.gradients(h, w)[0]
74 self.assertEquals("MatMul", w_grad.op.type)
75 self.assertEquals(w_grad.op._original_op, xw.op)
76 self.assertTrue(w_grad.op.get_attr("transpose_a"))
77 self.assertFalse(w_grad.op.get_attr("transpose_b"))
78
79 def testUnusedOutput(self):
80 with ops.Graph().as_default():

Callers

nothing calls this directly

Calls 7

constantFunction · 0.90
bias_addFunction · 0.90
assertEqualsMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
matmulMethod · 0.45
get_attrMethod · 0.45

Tested by

no test coverage detected