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: Initialize inference algorithm. It initializes hyperparameters
  and builds ops for the algorithm's computation graph.
  
  Args:
    ratio_loss: str or fn.
      Loss function minimized to get the ratio estimator. 'log' or 'hinge'.
      Alternatively, one can pass in a function of two inputs,
      `psamples` and `qsamples`, and output a point-wise value
      with shape matching the shapes of the two inputs.
docstr_tok: ["Initialize","inference","algorithm",".","It","initializes","hyperparameters","and","builds","ops","for","the","algorithm","'s","computation","graph",".","Args",":","ratio_loss",":","str","or","fn",".","Loss","function","minimized","to","get","the","ratio","estimator",".","'log","'","or","'hinge","'",".","Alternatively",",","one","can","pass","in","a","function","of","two","inputs",",","`","psamples","`","and","`","qsamples","`",",","and","output","a","point-wise","value","with","shape","matching","the","shapes","of","the","two","inputs","."]
code: def initialize(self, ratio_loss="log", *args, **kwargs):
      """Initialize inference algorithm. It initializes hyperparameters
      and builds ops for the algorithm's computation graph.
  
      Args:
        ratio_loss: str or fn.
          Loss function minimized to get the ratio estimator. 'log' or 'hinge'.
          Alternatively, one can pass in a function of two inputs,
          `psamples` and `qsamples`, and output a point-wise value
          with shape matching the shapes of the two inputs.
      """
      if callable(ratio_loss):
          self.ratio_loss = ratio_loss
      elif ratio_loss == "log":
          self.ratio_loss = log_loss
      elif ratio_loss == "hinge":
          self.ratio_loss = hinge_loss
      else:
          raise ValueError("Ratio loss not found:", ratio_loss)
  
      return super(ImplicitKLqp, self).initialize(*args, **kwargs)
  
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 2 for calling the ImplicitKLqp obj's underlying member method code with example usage: obj.initialize(ratio_loss) and returns: super