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

Method _jacobian

tensorflow/python/eager/backprop_test.py:1387–1398  ·  view source on GitHub ↗
(self, experimental_use_pfor)

Source from the content-addressed store, hash-verified

1385class JacobianTest(test.TestCase):
1386
1387 def _jacobian(self, experimental_use_pfor):
1388 persistent = context.executing_eagerly and not experimental_use_pfor
1389 with backprop.GradientTape(persistent=persistent) as g:
1390 x = constant_op.constant([1., 2.])
1391 y = constant_op.constant([3., 4.])
1392 g.watch(x)
1393 g.watch(y)
1394 z = x * x * y
1395 jacobian = g.jacobian(z, [x, y],
1396 experimental_use_pfor=experimental_use_pfor)
1397 answer = [array_ops.diag(2 * x * y), array_ops.diag(x * x)]
1398 return jacobian, answer
1399
1400 @test_util.run_v1_only('b/120545219')
1401 def testPfor(self):

Callers 3

testPforMethod · 0.95
testWhileLoopMethod · 0.95
_fMethod · 0.95

Calls 5

jacobianMethod · 0.80
GradientTapeMethod · 0.45
constantMethod · 0.45
watchMethod · 0.45
diagMethod · 0.45

Tested by

no test coverage detected