'Use pre-allocated (by layer containers) list of buffers for backpropagated error.
Only set deltas for layers that own their own deltas
Only allocate space if layer owns its own deltas (e.g., bias and activation work in-place,
so do not own their deltas).
Arguments:
delta_buffers (DeltasTree): list of pre-allocated tensors (provided by layer container)'

def set_deltas(self, delta_buffers):

    if ((self.next_layer is not None) and (self.next_layer.parallelism != self.parallelism)):
        self.owns_delta = True
    if (self.owns_delta and self.prev_layer):
        if (type(self.prev_layer) in (BranchNode,)):
            self.deltas = self.prev_layer.deltas
        else:
            self.deltas = self.be.iobuf(self.in_shape, shared=delta_buffers.buffers[0], parallelism=self.parallelism)
            delta_buffers.buffers.reverse()
    else:
        self.deltas = None
