Compute the layer output on a single minibatch. Parameters ---------- X : :py:class:`ndarray ` of shape `(n_ex, n_in)` Layer input, representing the `n_in`-dimensional features for a minibatch of `n_ex` examples. retain
(self, X, retain_derived=True)
| 2452 | } |
| 2453 | |
| 2454 | def forward(self, X, retain_derived=True): |
| 2455 | """ |
| 2456 | Compute the layer output on a single minibatch. |
| 2457 | |
| 2458 | Parameters |
| 2459 | ---------- |
| 2460 | X : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_in)` |
| 2461 | Layer input, representing the `n_in`-dimensional features for a |
| 2462 | minibatch of `n_ex` examples. |
| 2463 | retain_derived : bool |
| 2464 | Whether to retain the variables calculated during the forward pass |
| 2465 | for use later during backprop. If False, this suggests the layer |
| 2466 | will not be expected to backprop through wrt. this input. Default |
| 2467 | is True. |
| 2468 | |
| 2469 | Returns |
| 2470 | ------- |
| 2471 | Y : :py:class:`ndarray <numpy.ndarray>` of shape `(n_ex, n_out)` |
| 2472 | Layer output for each of the `n_ex` examples. |
| 2473 | """ |
| 2474 | if not self.is_initialized: |
| 2475 | self.n_in = X.shape[1] |
| 2476 | self._init_params() |
| 2477 | |
| 2478 | Y, Z = self._fwd(X) |
| 2479 | |
| 2480 | if retain_derived: |
| 2481 | self.X.append(X) |
| 2482 | self.derived_variables["Z"].append(Z) |
| 2483 | |
| 2484 | return Y |
| 2485 | |
| 2486 | def _fwd(self, X): |
| 2487 | """Actual computation of forward pass""" |
nothing calls this directly
no test coverage detected