Run a backward pass across all timesteps in the input. Parameters ---------- dLdA : :py:class:`ndarray ` of shape `(n_ex, n_out, n_t)` The gradient of the loss with respect to the layer output for each of the `n_ex` examples ac
(self, dLdA)
| 4344 | return np.dstack(Y) |
| 4345 | |
| 4346 | def backward(self, dLdA): |
| 4347 | """ |
| 4348 | Run a backward pass across all timesteps in the input. |
| 4349 | |
| 4350 | Parameters |
| 4351 | ---------- |
| 4352 | dLdA : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_out, n_t)` |
| 4353 | The gradient of the loss with respect to the layer output for each |
| 4354 | of the `n_ex` examples across all `n_t` timesteps. |
| 4355 | |
| 4356 | Returns |
| 4357 | ------- |
| 4358 | dLdX : :py:class:`ndarray <numpy.ndarray>` of shape (`n_ex`, `n_in`, `n_t`) |
| 4359 | The value of the hidden state for each of the `n_ex` examples |
| 4360 | across each of the `n_t` timesteps. |
| 4361 | """ # noqa: E501 |
| 4362 | assert self.cell.trainable, "Layer is frozen" |
| 4363 | dLdX = [] |
| 4364 | n_ex, n_out, n_t = dLdA.shape |
| 4365 | for t in reversed(range(n_t)): |
| 4366 | dLdXt, _ = self.cell.backward(dLdA[:, :, t]) |
| 4367 | dLdX.insert(0, dLdXt) |
| 4368 | dLdX = np.dstack(dLdX) |
| 4369 | return dLdX |
| 4370 | |
| 4371 | @property |
| 4372 | def derived_variables(self): |