(self, x, aka)
return x
The internal method called by the hooked layers after they are run.
The internal method called by the hooked layers after they are run.
The internal method called by the hooked layers after they are run .
def _postprocess_forward(self, x, aka):
        '''
        The internal method called by the hooked layers after they are run.
        '''
        # Retain output before edits, if desired.
        if aka in self._retained:
            if self._detach_retained[aka]:
                self._retained[aka] = x.detach()
            else:
                self._retained[aka] = x
        # Apply any edits requested.
        rule = self._editrule.get(aka, None)
        if rule is not None:
            x = rule(x, self, **(self._editargs[aka]))
        return x
def _postprocess_forward ( self , x , aka ) : # Retain output before edits, if desired. if aka in self . _retained : if self . _detach_retained [ aka ] : self . _retained [ aka ] = x . detach ( ) else : self . _retained [ aka ] = x # Apply any edits requested. rule = self . _editrule . get ( aka , None ) if rule is not None : x = rule ( x , self , * * ( self . _editargs [ aka ] ) ) return x