Run a forward pass across all timesteps in the input. Parameters ---------- X : :py:class:`ndarray ` of shape `(n_ex, n_in, n_t)` Input consisting of `n_ex` examples each of dimensionality `n_in` and extending for `n_t` timeste
(self, X)
| 4138 | } |
| 4139 | |
| 4140 | def forward(self, X): |
| 4141 | """ |
| 4142 | Run a forward pass across all timesteps in the input. |
| 4143 | |
| 4144 | Parameters |
| 4145 | ---------- |
| 4146 | X : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_in, n_t)` |
| 4147 | Input consisting of `n_ex` examples each of dimensionality `n_in` |
| 4148 | and extending for `n_t` timesteps. |
| 4149 | |
| 4150 | Returns |
| 4151 | ------- |
| 4152 | Y : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_out, n_t)` |
| 4153 | The value of the hidden state for each of the `n_ex` examples |
| 4154 | across each of the `n_t` timesteps. |
| 4155 | """ |
| 4156 | if not self.is_initialized: |
| 4157 | self.n_in = X.shape[1] |
| 4158 | self._init_params() |
| 4159 | |
| 4160 | Y = [] |
| 4161 | n_ex, n_in, n_t = X.shape |
| 4162 | for t in range(n_t): |
| 4163 | yt = self.cell.forward(X[:, :, t]) |
| 4164 | Y.append(yt) |
| 4165 | return np.dstack(Y) |
| 4166 | |
| 4167 | def backward(self, dLdA): |
| 4168 | """ |
nothing calls this directly
no test coverage detected