(x, y0)
| 1728 | |
| 1729 | @function.Defun() |
| 1730 | def Grad(x, y0): |
| 1731 | if use_forward_func: |
| 1732 | y = Model(x) |
| 1733 | else: |
| 1734 | y = _Model(x) |
| 1735 | loss = math_ops.reduce_mean( |
| 1736 | math_ops.reduce_sum(y0 * math_ops.log(y), 1), 0) |
| 1737 | arg_w, arg_b = function.get_extra_args() |
| 1738 | self.assertEqual(arg_w.get_shape(), tensor_shape.TensorShape([64, 64])) |
| 1739 | self.assertEqual(arg_b.get_shape(), tensor_shape.TensorShape([64])) |
| 1740 | dw, db = gradients_impl.gradients(loss, [arg_w, arg_b]) |
| 1741 | cvars.extend(function.get_extra_vars()) |
| 1742 | return loss, dw, db |
| 1743 | |
| 1744 | g = ops.Graph() |
| 1745 | with g.as_default(): |
nothing calls this directly
no test coverage detected