class_docstr: Variational inference with implicit probabilistic models
  [@tran2017deep].
  
  It minimizes the KL divergence
  
  $\text{KL}( q(z, \beta; \lambda) \| p(z, \beta \mid x) ),$
  
  where $z$ are local variables associated to a data point and
  $\beta$ are global variables shared across data points.
  
  Global latent variables require `log_prob()` and need to return a
  random sample when fetched from the graph. Local latent variables
  and observed variables require only a random sample when fetched
  from the graph. (This is true for both $p$ and $q$.)
  
  All variational factors must be reparameterizable: each of the
  random variables (`rv`) satisfies `rv.is_reparameterized` and
  `rv.is_continuous`.
  
  #### Notes
  
  Unlike `GANInference`, `discriminator` takes dict's as input,
  and must subset to the appropriate values through lexical scoping
  from the previously defined model and latent variables. This is
  necessary as the discriminator can take an arbitrary set of data,
  latent, and global variables.
  
  Note the type for `discriminator`'s output changes when one
  passes in the `scale` argument to `initialize()`.
  
  + If `scale` has at most one item, then `discriminator`
  outputs a tensor whose multiplication with that element is
  broadcastable. (For example, the output is a tensor and the single
  scale factor is a scalar.)
  + If `scale` has more than one item, then in order to scale
  its corresponding output, `discriminator` must output a
  dictionary of same size and keys as `scale`.
  
  The objective function also adds to itself a summation over all
  tensors in the `REGULARIZATION_LOSSES` collection.
docstr: Create an inference algorithm.
  
  Args:
    discriminator: function.
      Function (with parameters). Unlike `GANInference`, it is
      interpreted as a ratio estimator rather than a discriminator.
      It takes three arguments: a data dict, local latent variable
      dict, and global latent variable dict. As with GAN
      discriminators, it can take a batch of data points and local
      variables, of size $M$, and output a vector of length
      $M$.
    global_vars: dict of RandomVariable to RandomVariable.
      Identifying which variables in `latent_vars` are global
      variables, shared across data points. These will not be
      encompassed in the ratio estimation problem, and will be
      estimated with tractable variational approximations.
docstr_tok: ["Create","an","inference","algorithm",".","Args",":","discriminator",":","function",".","Function","(","with","parameters",")",".","Unlike","`","GANInference","`",",","it","is","interpreted","as","a","ratio","estimator","rather","than","a","discriminator",".","It","takes","three","arguments",":","a","data","dict",",","local","latent","variable","dict",",","and","global","latent","variable","dict",".","As","with","GAN","discriminators",",","it","can","take","a","batch","of","data","points","and","local","variables",",","of","size","$","M","$",",","and","output","a","vector","of","length","$","M","$",".","global_vars",":","dict","of","RandomVariable","to","RandomVariable",".","Identifying","which","variables","in","`","latent_vars","`","are","global","variables",",","shared","across","data","points",".","These","will","not","be","encompassed","in","the","ratio","estimation","problem",",","and","will","be","estimated","with","tractable","variational","approximations","."]
code: def __init__(
      self, latent_vars, data=None, discriminator=None, global_vars=None
  ):
      """Create an inference algorithm.
  
      Args:
        discriminator: function.
          Function (with parameters). Unlike `GANInference`, it is
          interpreted as a ratio estimator rather than a discriminator.
          It takes three arguments: a data dict, local latent variable
          dict, and global latent variable dict. As with GAN
          discriminators, it can take a batch of data points and local
          variables, of size $M$, and output a vector of length
          $M$.
        global_vars: dict of RandomVariable to RandomVariable.
          Identifying which variables in `latent_vars` are global
          variables, shared across data points. These will not be
          encompassed in the ratio estimation problem, and will be
          estimated with tractable variational approximations.
      """
      if not callable(discriminator):
          raise TypeError("discriminator must be a callable function.")
  
      self.discriminator = discriminator
      if global_vars is None:
          global_vars = {}
  
      check_latent_vars(global_vars)
      self.global_vars = global_vars
      # call grandparent's method; avoid parent (GANInference)
      super(GANInference, self).__init__(latent_vars, data)
  
file_path: edward/edward/inferences/implicit_klqp.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import six
  import tensorflow
  from edward.inferences.gan_inference import GANInference
  from edward.models import RandomVariable
  from edward.util import check_latent_vars, copy, get_session
label_desc: Use image node_id 1 to create a new ImplicitKLqp object from inherited base classes: GANInference with example: obj = ImplicitKLqp(latent_vars, data, discriminator, global_vars)