'Propagate shapes through the layers to configure, then allocate space.
Arguments:
dataset (NervanaDataIterator): Dataset iterator to perform initialization on
cost (Cost): Defines the function which the model is minimizing based
on the output of the last layer and the input labels.'

def initialize(self, dataset, cost=None):

    if self.initialized:
        return
    prev_input = self.layers.configure(self.noise_dim)
    if (cost is not None):
        cost.initialize(prev_input)
        self.cost = cost
    self.layers.generator.allocate(accumulate_updates=False)
    self.layers.discriminator.allocate(accumulate_updates=True)
    self.layers.allocate_deltas()
    self.initialized = True
    self.zbuf = self.be.iobuf(self.noise_dim)
    self.ybuf = self.be.iobuf((1,))
    self.z0 = self.be.iobuf(self.noise_dim)
    self.fill_noise(self.z0, normal=(self.noise_type == 'normal'))
    self.cost_dis = np.empty((1,), dtype=np.float32)
    self.current_batch = self.gen_iter = self.last_gen_batch = 0
