Пример #1
0
 def load_parameters(self, parameters):
     L = len(parameters) // 2
     deep = L - 1
     wide = parameters["W1"].shape[0]
     self._n_x = parameters["W1"].shape[1]
     self._n_y = parameters["W" + str(L)].shape[0]
     self._layer_dims = [self._n_x] + [wide] * deep + [self._n_y]
     self._activations = [Tanh()] * deep + [Linear()]
     self._parameters = parameters
Пример #2
0
 def initialize(cls, n_x=None, n_y=None, deep=2, wide=12):
     layer_dims = [n_x] + [wide] * deep + [n_y]
     parameters = initialize_parameters(layer_dims)
     activations = [Tanh()] * deep + [Linear()]
     attributes = {"_parameters": parameters,
                   "_activations": activations,
                   "_layer_dims": layer_dims,
                   "_n_x": n_x,
                   "_n_y": n_y}
     return cls(**attributes)