'Higher order decorator function that enables accumulation functionality for that function.
Object that use this decorator are required to have an acc_param attribute. This attribute
tuple declares the names for existing temp parameter and real parameter buffers. The
temp parameter buffer copies the value of the parameter buffer before f is called, and
after f is called the temp and normal buffers are summed. This decorator could be used
to wrap any function that may want to accumulate parameters instead of overwriting.'

@staticmethod
def accumulates(f):

    def accum_pre(self):
        '\n                                                copy    the    real    acc    params    to    the    temp    buffer\n                                                '
        if self.acc_on:
            for (acc_p, p) in self.acc_params:
                acc_p[:] = p
    def accum_post(self):
        '\n                                                element    wise    sum    of    temp    buffer    and    updated    param    buffers\n                                                '
        if self.acc_on:
            for (acc_p, p) in self.acc_params:
                p[:] = (p + acc_p)
    @wraps(f)
    def accum_wrapper(self, *args, **kwargs):
        '\n                                                Wraps    the    function    f    with    calls    to    accum_pre    and    accum_post\n                                                '
        if (not isinstance(self, Layer)):
            raise TypeError('accumulates    can    only    by    subclasses    of    Layer')
        accum_pre(self)
        out = f(self, *args, **kwargs)
        accum_post(self)
        return out
    return accum_wrapper
