Backward step.
(*args)
| 458 | |
| 459 | @function.Defun(*_Dtypes(bak_sig)) |
| 460 | def Bak(*args): |
| 461 | """Backward step.""" |
| 462 | (theta, state0, inputs, extras, d_state1) = _Pack(args, bak_sig) |
| 463 | (dtheta, dstate0, dinputs) = self._cell_grad(theta, state0, inputs, |
| 464 | extras, d_state1) |
| 465 | assert not function.get_extra_args(), ( |
| 466 | 'cell_grad is not pure with extra args: %s.' % |
| 467 | (function.get_extra_args())) |
| 468 | _AssertIsCompatible(dtheta, self._theta) |
| 469 | _AssertIsCompatible(dstate0, self._state) |
| 470 | _AssertIsCompatible(dinputs, self._inputs) |
| 471 | return _Flatten( |
| 472 | _ConvertNoneGradientToZeros([theta, state0, inputs], |
| 473 | [dtheta, dstate0, dinputs])) |
| 474 | |
| 475 | # Define defuns used by a functional_ops.If in BackwardLoopBody. |
| 476 | state_if_sig = [self._state, self._state] |
nothing calls this directly
no test coverage detected