(self, layername, rule=None, **kwargs)
Pass a fully-qualified layer name (E.g., module.submodule.conv3)
        to hook that layer and modify its output each time the model is run.
        The output of the layer will be modified to be a convex combination
        of the replacement and x interpolated according to the ablation, i.e.:
        `output = x * (1 - a) + (r * a)`.
Pass a fully-qualified layer name (E.g., module.submodule.conv3)
        to hook that layer and modify its output each time the model is run.
        The output of the layer will be modified to be a convex combination
        of the replacement and x interpolated according to the ablation, i.e.:
        `output = x * (1 - a) + (r * a)`.
Pass a fully - qualified layer name ( E . g . module . submodule . conv3 ) to hook that layer and modify its output each time the model is run . The output of the layer will be modified to be a convex combination of the replacement and x interpolated according to the ablation i . e . : output = x * ( 1 - a ) + ( r * a ) .
def edit_layer(self, layername, rule=None, **kwargs):
        '''
        Pass a fully-qualified layer name (E.g., module.submodule.conv3)
        to hook that layer and modify its output each time the model is run.
        The output of the layer will be modified to be a convex combination
        of the replacement and x interpolated according to the ablation, i.e.:
        `output = x * (1 - a) + (r * a)`.
        '''
        if not isinstance(layername, str):
            layername, aka = layername
        else:
            aka = layername

        # The default editing rule is apply_ablation_replacement
        if rule is None:
            rule = apply_ablation_replacement

        self.add_hooks([(layername, aka)])
        self._editargs[aka].update(kwargs)
        self._editrule[aka] = rule
def edit_layer ( self , layername , rule = None , * * kwargs ) : if not isinstance ( layername , str ) : layername , aka = layername else : aka = layername # The default editing rule is apply_ablation_replacement if rule is None : rule = apply_ablation_replacement self . add_hooks ( [ ( layername , aka ) ] ) self . _editargs [ aka ] . update ( kwargs ) self . _editrule [ aka ] = rule