class_docstr: Uses the model's gradient to suggest replacements for a given word.
  
  Based off of HotFlip: White-Box Adversarial Examples for Text
  Classification (Ebrahimi et al., 2018).
  https://arxiv.org/pdf/1712.06751.pdf
  
  Arguments:
      model (nn.Module): The model to attack. Model must have a
          `word_embeddings` matrix and `convert_id_to_word` function.
      top_n (int): the number of top words to return at each index
  >>> from textattack.transformations import WordSwapGradientBased
  >>> from textattack.augmentation import Augmenter
  
  >>> transformation = WordSwapGradientBased()
  >>> augmenter = Augmenter(transformation=transformation)
  >>> s = 'I am fabulous.'
  >>> augmenter.augment(s)
class_docstr_tok: ["Uses","the","model","'s","gradient","to","suggest","replacements","for","a","given","word",".","Based","off","of","HotFlip",":","White-Box","Adversarial","Examples","for","Text","Classification","(","Ebrahimi","et","al.",",","2018",")",".","https",":","\/\/arxiv.org\/pdf\/1712.06751.pdf","Arguments",":","model","(","nn.Module",")",":","The","model","to","attack",".","Model","must","have","a","`","word_embeddings","`","matrix","and","`","convert_id_to_word","`","function",".","top_n","(","int",")",":","the","number","of","top","words","to","return","at","each","index",">",">",">","from","textattack.transformations","import","WordSwapGradientBased",">",">",">","from","textattack.augmentation","import","Augmenter",">",">",">","transformation","=","WordSwapGradientBased","(",")",">",">",">","augmenter","=","Augmenter","(","transformation=transformation",")",">",">",">","s","=","'","I","am","fabulous",".","'",">",">",">","augmenter.augment","(","s",")"]
code: def extra_repr_keys(self):
      return ["top_n"]
  
file_path: TextAttack/textattack/transformations/word_swaps/word_swap_gradient_based.py
imports: import torch
  import textattack
  from textattack.shared import utils
  from textattack.shared.validators import validate_model_gradient_word_swap_compatibility
  from .word_swap import WordSwap
label_desc: Use image node_id 4 for calling the WordSwapGradientBased obj's underlying member method code with example usage: obj.extra_repr_keys() and returns: list