(f)
return accum_wrapper
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.
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.
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 .
def accumulates(f):
        """
        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.
        """
        def accum_pre(self):
            """
            copy the real acc params to the temp buffer
            """
            if self.acc_on:
                for (acc_p, p) in self.acc_params:
                    acc_p[:] = p

        def accum_post(self):
            """
            element wise sum of temp buffer and updated param buffers
            """
            if self.acc_on:
                for (acc_p, p) in self.acc_params:
                    p[:] = p + acc_p

        @wraps(f)
        def accum_wrapper(self, *args, **kwargs):
            """
            Wraps the function f with calls to accum_pre and accum_post
            """
            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
def accumulates ( f ) : def accum_pre ( self ) : """
            copy the real acc params to the temp buffer
            """ if self . acc_on : for ( acc_p , p ) in self . acc_params : acc_p [ : ] = p def accum_post ( self ) : """
            element wise sum of temp buffer and updated param buffers
            """ if self . acc_on : for ( acc_p , p ) in self . acc_params : p [ : ] = p + acc_p @ wraps ( f ) def accum_wrapper ( self , * args , * * kwargs ) : """
            Wraps the function f with calls to accum_pre and accum_post
            """ 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