class_docstr: Provides an interface for activation maximization via gradient descent.
  
  This class implements the gradient ascent algorithm in order to perform
  activation maximization with convolutional neural networks (CNN).
  
  `Activation maximization <https://pdfs.semanticscholar.org/65d9/94fb778a8d9e0f632659fb33a082949a50d3.pdf>`_
  is one form of feature visualization that allows us to visualize what CNN
  filters are "looking for", by applying each filter to an input image and
  updating the input image so as to maximize the activation of the filter of
  interest (i.e. treating it as a gradient ascent task with activation as the
  loss). The implementation is inspired by `this demo <https://blog.keras.io/category/demo.html>`_
  by Francois Chollet.
  
  Args:
      model: A neural network model from `torchvision.models
          <https://pytorch.org/docs/stable/torchvision/models.html>`_,
          typically without the fully-connected part of the network.
          e.g. torchvisions.alexnet(pretrained=True).features
      img_size (int, optional, default=224): The size of an input image to be
          optimized.
      lr (float, optional, default=1.): The step size (or learning rate) of
          the gradient ascent.
      use_gpu (bool, optional, default=False): Use GPU if set to True and
          `torch.cuda.is_available()`.
class_docstr_tok: ["Provides","an","interface","for","activation","maximization","via","gradient","descent",".","This","class","implements","the","gradient","ascent","algorithm","in","order","to","perform","activation","maximization","with","convolutional","neural","networks","(","CNN",")",".","`","Activation","maximization","<","https",":","\/\/pdfs.semanticscholar.org\/65d9\/94fb778a8d9e0f632659fb33a082949a50d3.pdf",">","`","_","is","one","form","of","feature","visualization","that","allows","us","to","visualize","what","CNN","filters","are","``","looking","for","''",",","by","applying","each","filter","to","an","input","image","and","updating","the","input","image","so","as","to","maximize","the","activation","of","the","filter","of","interest","(","i.e",".","treating","it","as","a","gradient","ascent","task","with","activation","as","the","loss",")",".","The","implementation","is","inspired","by","`","this","demo","<","https",":","\/\/blog.keras.io\/category\/demo.html",">","`","_","by","Francois","Chollet",".","Args",":","model",":","A","neural","network","model","from","`","torchvision.models","<","https",":","\/\/pytorch.org\/docs\/stable\/torchvision\/models.html",">","`","_",",","typically","without","the","fully-connected","part","of","the","network",".","e.g",".","torchvisions.alexnet","(","pretrained=True",")",".features","img_size","(","int",",","optional",",","default=224",")",":","The","size","of","an","input","image","to","be","optimized",".","lr","(","float",",","optional",",","default=1",".",")",":","The","step","size","(","or","learning","rate",")","of","the","gradient","ascent",".","use_gpu","(","bool",",","optional",",","default=False",")",":","Use","GPU","if","set","to","True","and","`","torch.cuda.is_available","(",")","`","."]
code: def lr(self):
      return self._lr
  
imports: import numpy
  import matplotlib.pyplot
  import torch
  import torch.nn
  from flashtorch.utils import apply_transforms, format_for_plotting, load_image, standardize_and_clip
label_desc: Use image node_id 2 for calling the GradientAscent obj's underlying member method code with example usage: obj.lr() and returns: self