(self, aka)
Internal method to remove a hook, restoring the original forward method.
Internal method to remove a hook, restoring the original forward method.
Internal method to remove a hook restoring the original forward method .
def _unhook_layer(self, aka):
        '''
        Internal method to remove a hook, restoring the original forward method.
        '''
        if aka not in self._hooked_layer:
            return
        layername = self._hooked_layer[aka]
        # Remove any retained data and any edit rules
        if aka in self._retained:
            del self._retained[aka]
            del self._detach_retained[aka]
        self.remove_edits(aka)
        # Restore the unhooked method for the layer
        layer, check, old_forward = self._old_forward[layername]
        assert check == aka
        if old_forward is None:
            if 'forward' in layer.__dict__:
                del layer.__dict__['forward']
        else:
            layer.forward = old_forward
        del self._old_forward[layername]
        del self._hooked_layer[aka]
def _unhook_layer ( self , aka ) : if aka not in self . _hooked_layer : return layername = self . _hooked_layer [ aka ] # Remove any retained data and any edit rules if aka in self . _retained : del self . _retained [ aka ] del self . _detach_retained [ aka ] self . remove_edits ( aka ) # Restore the unhooked method for the layer layer , check , old_forward = self . _old_forward [ layername ] assert check == aka if old_forward is None : if 'forward' in layer . __dict__ : del layer . __dict__ [ 'forward' ] else : layer . forward = old_forward del self . _old_forward [ layername ] del self . _hooked_layer [ aka ]