Create attack¶
            create_attack(attack, model=None, normalize=None, device=None, *, eps=None, **kwargs)
¶
    Create a torchattack instance based on the provided attack name and config.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                attack
             | 
            
                  Union[Type[Attack], str]
             | 
            
               The attack to create, either by name or class instance.  | 
            required | 
                model
             | 
            
                  Optional[Union[Module, AttackModel]]
             | 
            
               The model to be attacked. Can be an instance of nn.Module or AttackModel. Defaults to None.  | 
            
                  None
             | 
          
                normalize
             | 
            
                  Optional[Callable[[Tensor], Tensor]]
             | 
            
               The normalization function specific to the model. Defaults to None.  | 
            
                  None
             | 
          
                device
             | 
            
                  Optional[device]
             | 
            
               The device on which the attack will be executed. Defaults to None.  | 
            
                  None
             | 
          
                eps
             | 
            
                  Optional[float]
             | 
            
               The epsilon value for the attack. Defaults to None.  | 
            
                  None
             | 
          
                kwargs
             | 
            
                  Any
             | 
            
               Additional config parameters for the attack. Defaults to None.  | 
            
                  {}
             | 
          
Returns:
| Type | Description | 
|---|---|
                  Attack
             | 
            
               An instance of the specified attack.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ValueError
             | 
            
               If the specified attack name is not supported within torchattack.  |