docstr: Total variation regularizer encourages blobbier and coherent image structures, akin to natural images.
  See `section 3.2.2` in
  [Visualizing deep convolutional neural networks using natural pre-images](https://arxiv.org/pdf/1512.02017v3.pdf)
  for details.
  
  Args:
      img_input: An image tensor of shape: `(samples, channels, image_dims...)` if `image_data_format=`channels_first`
          or `(samples, image_dims..., channels)` if `image_data_format=channels_last`.
      beta: Smaller values of beta give sharper but 'spikier' images.
          Values \(\in [1.5, 3.0]\) are recommended as a reasonable compromise. (Default value = 2.)
docstr_tok: ["Total","variation","regularizer","encourages","blobbier","and","coherent","image","structures",",","akin","to","natural","images",".","See","`","section","3.2.2","`","in","[","Visualizing","deep","convolutional","neural","networks","using","natural","pre-images","]","(","https",":","\/\/arxiv.org\/pdf\/1512.02017v3.pdf",")","for","details",".","Args",":","img_input",":","An","image","tensor","of","shape",":","`","(","samples",",","channels",",","image_dims","...",")","`","if","`","image_data_format=","`","channels_first","`","or","`","(","samples",",","image_dims","...",",","channels",")","`","if","`","image_data_format=channels_last","`",".","beta",":","Smaller","values","of","beta","give","sharper","but","'spikier","'","images",".","Values","\\","(","\\in","[","1.5",",","3.0","]","\\",")","are","recommended","as","a","reasonable","compromise",".","(","Default","value","=","2",".",")"]
code: def __init__(self, img_input, beta=2.0):
      """Total variation regularizer encourages blobbier and coherent image structures, akin to natural images.
      See `section 3.2.2` in
      [Visualizing deep convolutional neural networks using natural pre-images](https://arxiv.org/pdf/1512.02017v3.pdf)
      for details.
  
      Args:
          img_input: An image tensor of shape: `(samples, channels, image_dims...)` if `image_data_format=`channels_first`
              or `(samples, image_dims..., channels)` if `image_data_format=channels_last`.
          beta: Smaller values of beta give sharper but 'spikier' images.
              Values \(\in [1.5, 3.0]\) are recommended as a reasonable compromise. (Default value = 2.)
      """
      super(TotalVariation, self).__init__()
      self.name = "TV({}) Loss".format(beta)
      self.img = img_input
      self.beta = beta
  
file_path: keras-vis/vis/regularizers.py
imports: from __future__ import absolute_import
  from __future__ import division
  import numpy
  from keras import backend
  from .losses import Loss
  from .utils import utils
label_desc: Use image node_id 1 to create a new TotalVariation object from inherited base classes: Loss with example: obj = TotalVariation(img_input, beta)