MCPcopy
hub / github.com/ddbourgin/numpy-ml / forward

Method forward

numpy_ml/neural_nets/layers/layers.py:4319–4344  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

4317 }
4318
4319 def forward(self, X):
4320 """
4321 Run a forward pass across all timesteps in the input.
4322
4323 Parameters
4324 ----------
4325 X : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_in, n_t)`
4326 Input consisting of `n_ex` examples each of dimensionality `n_in`
4327 and extending for `n_t` timesteps.
4328
4329 Returns
4330 -------
4331 Y : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_out, n_t)`
4332 The value of the hidden state for each of the `n_ex` examples
4333 across each of the `n_t` timesteps.
4334 """
4335 if not self.is_initialized:
4336 self.n_in = X.shape[1]
4337 self._init_params()
4338
4339 Y = []
4340 n_ex, n_in, n_t = X.shape
4341 for t in range(n_t):
4342 yt, _ = self.cell.forward(X[:, :, t])
4343 Y.append(yt)
4344 return np.dstack(Y)
4345
4346 def backward(self, dLdA):
4347 """

Callers

nothing calls this directly

Calls 2

_init_paramsMethod · 0.95
forwardMethod · 0.45

Tested by

no test coverage detected