def allocate_deltas(self, global_deltas=None):
        def needs_extra_delta(ll):
            return True if issubclass(ll.__class__, Broadcast) else False

        self.global_deltas = global_deltas

        if self.global_deltas is None:
            # See if we have any inception-ish layers:
            max_in_size = 0
            for l in self.layers[1:]:
                in_size = self.be.shared_iobuf_size(l.in_shape, l.parallelism)
                if in_size > max_in_size:
                    max_in_size = in_size

            ndelta_bufs = 4 if any([needs_extra_delta(l) for l in self.layers]) else 2
            if max_in_size != 0:
                self.global_deltas = [self.be.iobuf(
                    max_in_size, parallelism="Data") for _ in range(ndelta_bufs)]

        for l in self.layers:
            l.set_deltas(self.global_deltas)
dataset/ETHPy150Open NervanaSystems/neon/neon/layers/container.py/Sequential.allocate_deltas/original