(self, delta_buffers)
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)
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).
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 ) .
def set_deltas(self, delta_buffers):
        """
        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)
        """
        bottom_buffer = delta_buffers.buffers[0]

        nested_deltas = delta_buffers.decend()
        assert nested_deltas is not None
        for l in self.layers:
            l.layers[0].set_deltas(delta_buffers)

            # mkl need allocate new deltas
            l.layers[0].deltas = self.be.allocate_new_deltas(
                l.layers[0].deltas, l.layers[0].in_shape, l.layers[0].parallelism)

            delta_buffers.buffers.reverse()  # undo that last reverse
            for sublayer in l.layers[1:]:
                sublayer.set_deltas(nested_deltas)

        # Special case if originating from a branch node
        if type(self.prev_layer) is BranchNode:
            self.deltas = self.be.iobuf(self.in_shape, shared=self.prev_layer.deltas,
                                        parallelism=self.parallelism)
        else:
            self.deltas = self.be.iobuf(self.in_shape, shared=bottom_buffer,
                                        parallelism=self.parallelism)
            delta_buffers.buffers.reverse()
def set_deltas ( self , delta_buffers ) : bottom_buffer = delta_buffers . buffers [ 0 ] nested_deltas = delta_buffers . decend ( ) assert nested_deltas is not None for l in self . layers : l . layers [ 0 ] . set_deltas ( delta_buffers ) # mkl need allocate new deltas l . layers [ 0 ] . deltas = self . be . allocate_new_deltas ( l . layers [ 0 ] . deltas , l . layers [ 0 ] . in_shape , l . layers [ 0 ] . parallelism ) delta_buffers . buffers . reverse ( ) # undo that last reverse for sublayer in l . layers [ 1 : ] : sublayer . set_deltas ( nested_deltas ) # Special case if originating from a branch node if type ( self . prev_layer ) is BranchNode : self . deltas = self . be . iobuf ( self . in_shape , shared = self . prev_layer . deltas , parallelism = self . parallelism ) else : self . deltas = self . be . iobuf ( self . in_shape , shared = bottom_buffer , parallelism = self . parallelism ) delta_buffers . buffers . reverse ( )