class_docstr: Parameter estimation with GAN-style training
  [@goodfellow2014generative].
  
  Works for the class of implicit (and differentiable) probabilistic
  models. These models do not require a tractable density and assume
  only a program that generates samples.
  
  #### Notes
  
  `GANInference` does not support latent variable inference. Note
  that GAN-style training also samples from the prior: this does not
  work well for latent variables that are shared across many data
  points (global variables).
  
  In building the computation graph for inference, the
  discriminator's parameters can be accessed with the variable scope
  "Disc".
  
  GANs also only work for one observed random variable in `data`.
  
  The objective function also adds to itself a summation over all
  tensors in the `REGULARIZATION_LOSSES` collection.
  
  #### Examples
  
  ```python
  z = Normal(loc=tf.zeros([100, 10]), scale=tf.ones([100, 10]))
  x = generative_network(z)
  
  inference = ed.GANInference({x: x_data}, discriminator)
  ```
docstr: Initialize inference algorithm. It initializes hyperparameters
  and builds ops for the algorithm's computation graph.
  
  Args:
    optimizer: str or tf.train.Optimizer.
      A TensorFlow optimizer, to use for optimizing the generator
      objective. Alternatively, one can pass in the name of a
      TensorFlow optimizer, and default parameters for the optimizer
      will be used.
    optimizer_d: str or tf.train.Optimizer.
      A TensorFlow optimizer, to use for optimizing the discriminator
      objective. Alternatively, one can pass in the name of a
      TensorFlow optimizer, and default parameters for the optimizer
      will be used.
    global_step: tf.Variable.
      Optional `Variable` to increment by one after the variables
      for the generator have been updated. See
      `tf.train.Optimizer.apply_gradients`.
    global_step_d: tf.Variable.
      Optional `Variable` to increment by one after the variables
      for the discriminator have been updated. See
      `tf.train.Optimizer.apply_gradients`.
    var_list: list of tf.Variable.
      List of TensorFlow variables to optimize over (in the generative
      model). Default is all trainable variables that `latent_vars`
      and `data` depend on.
docstr_tok: ["Initialize","inference","algorithm",".","It","initializes","hyperparameters","and","builds","ops","for","the","algorithm","'s","computation","graph",".","Args",":","optimizer",":","str","or","tf.train.Optimizer",".","A","TensorFlow","optimizer",",","to","use","for","optimizing","the","generator","objective",".","Alternatively",",","one","can","pass","in","the","name","of","a","TensorFlow","optimizer",",","and","default","parameters","for","the","optimizer","will","be","used",".","optimizer_d",":","str","or","tf.train.Optimizer",".","A","TensorFlow","optimizer",",","to","use","for","optimizing","the","discriminator","objective",".","Alternatively",",","one","can","pass","in","the","name","of","a","TensorFlow","optimizer",",","and","default","parameters","for","the","optimizer","will","be","used",".","global_step",":","tf.Variable",".","Optional","`","Variable","`","to","increment","by","one","after","the","variables","for","the","generator","have","been","updated",".","See","`","tf.train.Optimizer.apply_gradients","`",".","global_step_d",":","tf.Variable",".","Optional","`","Variable","`","to","increment","by","one","after","the","variables","for","the","discriminator","have","been","updated",".","See","`","tf.train.Optimizer.apply_gradients","`",".","var_list",":","list","of","tf.Variable",".","List","of","TensorFlow","variables","to","optimize","over","(","in","the","generative","model",")",".","Default","is","all","trainable","variables","that","`","latent_vars","`","and","`","data","`","depend","on","."]
code: def initialize(
      self,
      optimizer=None,
      optimizer_d=None,
      global_step=None,
      global_step_d=None,
      var_list=None,
      *args,
      **kwargs,
  ):
      """Initialize inference algorithm. It initializes hyperparameters
      and builds ops for the algorithm's computation graph.
  
      Args:
        optimizer: str or tf.train.Optimizer.
          A TensorFlow optimizer, to use for optimizing the generator
          objective. Alternatively, one can pass in the name of a
          TensorFlow optimizer, and default parameters for the optimizer
          will be used.
        optimizer_d: str or tf.train.Optimizer.
          A TensorFlow optimizer, to use for optimizing the discriminator
          objective. Alternatively, one can pass in the name of a
          TensorFlow optimizer, and default parameters for the optimizer
          will be used.
        global_step: tf.Variable.
          Optional `Variable` to increment by one after the variables
          for the generator have been updated. See
          `tf.train.Optimizer.apply_gradients`.
        global_step_d: tf.Variable.
          Optional `Variable` to increment by one after the variables
          for the discriminator have been updated. See
          `tf.train.Optimizer.apply_gradients`.
        var_list: list of tf.Variable.
          List of TensorFlow variables to optimize over (in the generative
          model). Default is all trainable variables that `latent_vars`
          and `data` depend on.
      """
      # call grandparent's method; avoid parent (VariationalInference)
      super(VariationalInference, self).initialize(*args, **kwargs)
  
      (
          self.loss,
          grads_and_vars,
          self.loss_d,
          grads_and_vars_d,
      ) = self.build_loss_and_gradients(var_list)
  
      optimizer, global_step = _build_optimizer(optimizer, global_step)
      optimizer_d, global_step_d = _build_optimizer(
          optimizer_d, global_step_d
      )
  
      self.train = optimizer.apply_gradients(
          grads_and_vars, global_step=global_step
      )
      self.train_d = optimizer_d.apply_gradients(
          grads_and_vars_d, global_step=global_step_d
      )
  
      if self.logging:
          tf.summary.scalar(
              "loss", self.loss, collections=[self._summary_key]
          )
          tf.summary.scalar(
              "loss/discriminative",
              self.loss_d,
              collections=[self._summary_key],
          )
          self.summarize = tf.summary.merge_all(key=self._summary_key)
  
file_path: edward/edward/inferences/gan_inference.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import six
  import tensorflow
  from edward.inferences.variational_inference import VariationalInference
  from edward.util import get_session
label_desc: Use image node_id 2 for calling the GANInference obj's underlying member method code with example usage: obj.initialize(optimizer, optimizer_d, global_step, global_step_d, var_list) without return types