(function)
| 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. |
nothing calls this directly
no test coverage detected