Flatten a multidimensional input into a 2D matrix. Parameters ---------- keep_dim : {'first', 'last', -1} The dimension of the original input to retain. Typically used for retaining the minibatch dimension.. If -1, flatten all dimensions.
(self, keep_dim="first", optimizer=None)
| 858 | |
| 859 | class Flatten(LayerBase): |
| 860 | def __init__(self, keep_dim="first", optimizer=None): |
| 861 | """ |
| 862 | Flatten a multidimensional input into a 2D matrix. |
| 863 | |
| 864 | Parameters |
| 865 | ---------- |
| 866 | keep_dim : {'first', 'last', -1} |
| 867 | The dimension of the original input to retain. Typically used for |
| 868 | retaining the minibatch dimension.. If -1, flatten all dimensions. |
| 869 | Default is 'first'. |
| 870 | optimizer : str, :doc:`Optimizer <numpy_ml.neural_nets.optimizers>` object, or None |
| 871 | The optimization strategy to use when performing gradient updates |
| 872 | within the :meth:`update` method. If None, use the :class:`SGD |
| 873 | <numpy_ml.neural_nets.optimizers.SGD>` optimizer with |
| 874 | default parameters. Default is None. |
| 875 | |
| 876 | Attributes |
| 877 | ---------- |
| 878 | X : list |
| 879 | Unused |
| 880 | gradients : dict |
| 881 | Unused |
| 882 | parameters : dict |
| 883 | Unused |
| 884 | hyperparameters : dict |
| 885 | Dictionary of layer hyperparameters |
| 886 | derived_variables : dict |
| 887 | Dictionary of any intermediate values computed during |
| 888 | forward/backward propagation. |
| 889 | """ # noqa: E501 |
| 890 | super().__init__(optimizer) |
| 891 | |
| 892 | self.keep_dim = keep_dim |
| 893 | self._init_params() |
| 894 | |
| 895 | def _init_params(self): |
| 896 | self.gradients = {} |
nothing calls this directly
no test coverage detected