'Allocate output buffer to store activations from fprop.
Arguments:
shared_outputs (Tensor, optional): pre-allocated tensor for activations to be
computed into
accumulate_updates bool: allocate additional scratch accumulation
buffers.'

def allocate(self, shared_outputs=None, accumulate_updates=False):

    super(BatchNorm, self).allocate(shared_outputs)
    self.y = self.outputs.reshape((self.nfm, (-1)))
    self.xvar = self.be.zeros((self.nfm, 1), dtype=self.stats_dtype)
    self.accumulate_updates = accumulate_updates
    if (self.allparams is None):
        self.init_params(self.nfm)
    if ((self.prev_layer in (None, True)) or (not getattr(self.prev_layer, 'batch_sum', None))):
        self.xsum = self.be.zeros((self.nfm, 1), dtype=self.stats_dtype, **self.get_param_attrs())
        self.xsum.auto_reduce = False
        self.compute_batch_sum = True
    else:
        self.xsum = self.prev_layer.batch_sum
        self.compute_batch_sum = False
