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: Run one iteration of optimization.
  
  Args:
    feed_dict: dict.
      Feed dictionary for a TensorFlow session run. It is used to feed
      placeholders that are not fed during initialization.
    variables: str.
      Which set of variables to update. Either "Disc" or "Gen".
      Default is both.
  
  Returns:
    dict.
    Dictionary of algorithm-specific information. In this case, the
    iteration number and generative and discriminative losses.
  
  #### Notes
  
  The outputted iteration number is the total number of calls to
  `update`. Each update may include updating only a subset of
  parameters.
docstr_tok: ["Run","one","iteration","of","optimization",".","Args",":","feed_dict",":","dict",".","Feed","dictionary","for","a","TensorFlow","session","run",".","It","is","used","to","feed","placeholders","that","are","not","fed","during","initialization",".","variables",":","str",".","Which","set","of","variables","to","update",".","Either","``","Disc","''","or","``","Gen","''",".","Default","is","both",".","Returns",":","dict",".","Dictionary","of","algorithm-specific","information",".","In","this","case",",","the","iteration","number","and","generative","and","discriminative","losses",".","#","#","#","#","Notes","The","outputted","iteration","number","is","the","total","number","of","calls","to","`","update","`",".","Each","update","may","include","updating","only","a","subset","of","parameters","."]
code: def update(self, feed_dict=None, variables=None):
      """Run one iteration of optimization.
  
      Args:
        feed_dict: dict.
          Feed dictionary for a TensorFlow session run. It is used to feed
          placeholders that are not fed during initialization.
        variables: str.
          Which set of variables to update. Either "Disc" or "Gen".
          Default is both.
  
      Returns:
        dict.
        Dictionary of algorithm-specific information. In this case, the
        iteration number and generative and discriminative losses.
  
      #### Notes
  
      The outputted iteration number is the total number of calls to
      `update`. Each update may include updating only a subset of
      parameters.
      """
      if feed_dict is None:
          feed_dict = {}
  
      for key, value in six.iteritems(self.data):
          if (
              isinstance(key, tf.Tensor)
              and "Placeholder" in key.op.type
          ):
              feed_dict[key] = value
  
      sess = get_session()
      if variables is None:
          _, _, t, loss, loss_d = sess.run(
              [
                  self.train,
                  self.train_d,
                  self.increment_t,
                  self.loss,
                  self.loss_d,
              ],
              feed_dict,
          )
      elif variables == "Gen":
          _, t, loss = sess.run(
              [self.train, self.increment_t, self.loss], feed_dict
          )
          loss_d = 0.0
      elif variables == "Disc":
          _, t, loss_d = sess.run(
              [self.train_d, self.increment_t, self.loss_d], feed_dict
          )
          loss = 0.0
      else:
          raise NotImplementedError(
              "variables must be None, 'Gen', or 'Disc'."
          )
  
      if self.debug:
          sess.run(self.op_check, feed_dict)
  
      if self.logging and self.n_print != 0:
          if t == 1 or t % self.n_print == 0:
              summary = sess.run(self.summarize, feed_dict)
              self.train_writer.add_summary(summary, t)
  
      return {"t": t, "loss": loss, "loss_d": loss_d}
  
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 4 for calling the GANInference obj's underlying member method code with example usage: obj.update(feed_dict, variables) and returns: dict