MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/neural_nets/layers/layers.py:860–893  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

858
859class 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 = {}

Callers

nothing calls this directly

Calls 2

_init_paramsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected