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

Method _compute_gradient

tensorflow/python/saved_model/load_test.py:933–938  ·  view source on GitHub ↗
(function)

Source from the content-addressed store, hash-verified

931 root.f = func.get_concrete_function()
932
933 def _compute_gradient(function):
934 with backprop.GradientTape() as tape:
935 inp = constant_op.constant(1.)
936 tape.watch(inp)
937 output = function(inp)
938 return tape.gradient(output, inp)
939
940 self.assertEqual(2., _compute_gradient(root.f).numpy())
941 # TODO(andresp): Fix exporting of loaded concrete functions as signatures.

Callers

nothing calls this directly

Calls 5

gradientMethod · 0.80
functionFunction · 0.50
GradientTapeMethod · 0.45
constantMethod · 0.45
watchMethod · 0.45

Tested by

no test coverage detected