class_docstr: This class implements a DGM with the TensorFlow framework.
class_docstr_tok: ["This","class","implements","a","DGM","with","the","TensorFlow","framework","."]
docstr: Initialization specific to TensorFlow generator implementations.
  
  :param input_ph: The input placeholder.
  :param model: TensorFlow model, neural network or other.
  :param loss: The loss function for which to compute gradients. This parameter is necessary when training the
               model and when computing gradients w.r.t. the loss function.
  :param sess: Computation session.
  :param channels_first: Set channels first or last.
  :param clip_values: Tuple of the form `(min, max)` of floats or `np.ndarray` representing the minimum and
                      maximum values allowed for features. If floats are provided, these will be used as the range
                      of all features. If arrays are provided, each value will be considered the bound for a
                      feature, thus the shape of clip values needs to match the total number of features.
  :param preprocessing_defences: Preprocessing defence(s) to be applied by the classifier.
  :param postprocessing_defences: Postprocessing defence(s) to be applied by the classifier.
  :param preprocessing: Tuple of the form `(subtrahend, divisor)` of floats or `np.ndarray` of values to be
                        used for data preprocessing. The first value will be subtracted from the input. The input
                        will then be divided by the second one.
  :param feed_dict: A feed dictionary for the session run evaluating the classifier. This dictionary includes all
                    additionally required placeholders except the placeholders defined in this class.
docstr_tok: ["Initialization","specific","to","TensorFlow","generator","implementations",".",":","param","input_ph",":","The","input","placeholder",".",":","param","model",":","TensorFlow","model",",","neural","network","or","other",".",":","param","loss",":","The","loss","function","for","which","to","compute","gradients",".","This","parameter","is","necessary","when","training","the","model","and","when","computing","gradients","w.r.t",".","the","loss","function",".",":","param","sess",":","Computation","session",".",":","param","channels_first",":","Set","channels","first","or","last",".",":","param","clip_values",":","Tuple","of","the","form","`","(","min",",","max",")","`","of","floats","or","`","np.ndarray","`","representing","the","minimum","and","maximum","values","allowed","for","features",".","If","floats","are","provided",",","these","will","be","used","as","the","range","of","all","features",".","If","arrays","are","provided",",","each","value","will","be","considered","the","bound","for","a","feature",",","thus","the","shape","of","clip","values","needs","to","match","the","total","number","of","features",".",":","param","preprocessing_defences",":","Preprocessing","defence","(","s",")","to","be","applied","by","the","classifier",".",":","param","postprocessing_defences",":","Postprocessing","defence","(","s",")","to","be","applied","by","the","classifier",".",":","param","preprocessing",":","Tuple","of","the","form","`","(","subtrahend",",","divisor",")","`","of","floats","or","`","np.ndarray","`","of","values","to","be","used","for","data","preprocessing",".","The","first","value","will","be","subtracted","from","the","input",".","The","input","will","then","be","divided","by","the","second","one",".",":","param","feed_dict",":","A","feed","dictionary","for","the","session","run","evaluating","the","classifier",".","This","dictionary","includes","all","additionally","required","placeholders","except","the","placeholders","defined","in","this","class","."]
code: def __init__(
      self,
      input_ph: "tf.Placeholder",
      model: "tf.Tensor",
      loss: Optional["tf.Tensor"] = None,
      sess: Optional["tf.compat.v1.Session"] = None,
      channels_first=False,
      clip_values: Optional["CLIP_VALUES_TYPE"] = None,
      preprocessing_defences: Union[
          "Preprocessor", List["Preprocessor"], None
      ] = None,
      postprocessing_defences: Union[
          "Postprocessor", List["Postprocessor"], None
      ] = None,
      preprocessing: "PREPROCESSING_TYPE" = (0.0, 1.0),
      feed_dict: Optional[Dict[Any, Any]] = None,
  ):
      """
      Initialization specific to TensorFlow generator implementations.
  
      :param input_ph: The input placeholder.
      :param model: TensorFlow model, neural network or other.
      :param loss: The loss function for which to compute gradients. This parameter is necessary when training the
                   model and when computing gradients w.r.t. the loss function.
      :param sess: Computation session.
      :param channels_first: Set channels first or last.
      :param clip_values: Tuple of the form `(min, max)` of floats or `np.ndarray` representing the minimum and
                          maximum values allowed for features. If floats are provided, these will be used as the range
                          of all features. If arrays are provided, each value will be considered the bound for a
                          feature, thus the shape of clip values needs to match the total number of features.
      :param preprocessing_defences: Preprocessing defence(s) to be applied by the classifier.
      :param postprocessing_defences: Postprocessing defence(s) to be applied by the classifier.
      :param preprocessing: Tuple of the form `(subtrahend, divisor)` of floats or `np.ndarray` of values to be
                            used for data preprocessing. The first value will be subtracted from the input. The input
                            will then be divided by the second one.
      :param feed_dict: A feed dictionary for the session run evaluating the classifier. This dictionary includes all
                        additionally required placeholders except the placeholders defined in this class.
      """
      import tensorflow.compat.v1 as tf
  
      super().__init__(
          model=model,
          clip_values=clip_values,
          channels_first=channels_first,
          preprocessing_defences=preprocessing_defences,
          postprocessing_defences=postprocessing_defences,
          preprocessing=preprocessing,
      )
  
      self._input_ph = input_ph
      self._encoding_length = self.input_ph.shape[1]
      self._loss = loss
      if self.loss is not None:
          self._grad = tf.gradients(self.loss, self.input_ph)
      if feed_dict is None:
          self._feed_dict = {}
      else:
          self._feed_dict = feed_dict
  
      # Assign session
      if sess is None:  # pragma: no cover
          raise ValueError("A session cannot be None.")
          # TODO do the same thing for all not None variables
      self._sess = sess
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Any, Dict, List, Optional, Union, Tuple, TYPE_CHECKING
  import numpy
  from art.estimators.generation.generator import GeneratorMixin
  from art.estimators.tensorflow import TensorFlowEstimator, TensorFlowV2Estimator
label_desc: Use image node_id 1 to create a new TensorFlowGenerator object from inherited base classes: GeneratorMixin, TensorFlowEstimator with example: obj = TensorFlowGenerator(input_ph, model, loss, sess, channels_first, clip_values, preprocessing_defences, postprocessing_defences, preprocessing, feed_dict)