'Allocate output buffer to store activations from fprop.
Arguments:
shared_outputs (Tensor, optional): pre-allocated tensor for activations to be
computed into'

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

    self.accumulate_updates = accumulate_updates
    alloc_layers = [l for l in self.layers if l.owns_output]
    if ('accumulate_updates' in signature(alloc_layers[(-1)].allocate).parameters):
        alloc_layers[(-1)].allocate(shared_outputs, accumulate_updates=accumulate_updates)
    else:
        alloc_layers[(-1)].allocate(shared_outputs)
    for l in self.layers:
        if ('accumulate_updates' in signature(l.allocate).parameters):
            l.allocate(accumulate_updates=accumulate_updates)
        else:
            l.allocate()
