from .flatten import flatten
import autograd.numpy.random as npr


class WeightsAndBiases(dict):
    """
    A class that stores the WeightsAndBiases for convolution.
    """
    def __init__(self):
        # super(WeightsAndBiases, self).__init__()
        # self.initialize_layers(n_layers, shapes)
        # self.vect, self.unflattener = self.flattened()
        pass

    def flattened(self):
        """
        Deprecated. Don't bother with this.
        """
        flattened_weights, unflattener = flatten(self)
        self.vect = flattened_weights
        self.unflattener = unflattener
        return flattened_weights, unflattener

    def add(self, name, shape):
        """
        Add a randomly initialized set of weights/biases to the WB class. It
        is initialized with mean 0 and variance 0.1

        Parameters:
        ===========
        - name: (string) self_weights, nbr_weights, biases, or some other name.
        - shape: (tuple) the dimensions of the layer.
        """
        self[name] = npr.normal(0, 0.1, shape)

@@ -58,16 +58,44 @@
  as npr%0A
+import autograd.numpy as np%0A
 %0A%0Aclass 
@@ -1062,16 +1062,18 @@
 al(0, 0.
+00
 1, shape
@@ -1074,8 +1074,46 @@
  shape)%0A
+        # self%5Bname%5D = np.ones(shape)%0A

set initialized weights to be normal(0, 0.001)