class_docstr: Abstract base class for inference. All inference algorithms in
  Edward inherit from `Inference`, sharing common methods and
  properties via a class hierarchy.
  
  Specific algorithms typically inherit from other subclasses of
  `Inference` rather than `Inference` directly. For example, one
  might inherit from the abstract classes `MonteCarlo` or
  `VariationalInference`.
  
  To build an algorithm inheriting from `Inference`, one must at the
  minimum implement `initialize` and `update`: the former builds
  the computational graph for the algorithm; the latter runs the
  computational graph for the algorithm.
  
  To reset inference (e.g., internal variable counters incremented
  over training), fetch inference's reset ops from session with
  `sess.run(inference.reset)`.
  
  #### Examples
  
  ```python
  # Set up probability model.
  mu = Normal(loc=0.0, scale=1.0)
  x = Normal(loc=mu, scale=1.0, sample_shape=50)
  
  # Set up posterior approximation.
  qmu_loc = tf.Variable(tf.random_normal([]))
  qmu_scale = tf.nn.softplus(tf.Variable(tf.random_normal([])))
  qmu = Normal(loc=qmu_loc, scale=qmu_scale)
  
  inference = ed.Inference({mu: qmu}, data={x: tf.zeros(50)})
  ```
class_docstr_tok: ["Abstract","base","class","for","inference",".","All","inference","algorithms","in","Edward","inherit","from","`","Inference","`",",","sharing","common","methods","and","properties","via","a","class","hierarchy",".","Specific","algorithms","typically","inherit","from","other","subclasses","of","`","Inference","`","rather","than","`","Inference","`","directly",".","For","example",",","one","might","inherit","from","the","abstract","classes","`","MonteCarlo","`","or","`","VariationalInference","`",".","To","build","an","algorithm","inheriting","from","`","Inference","`",",","one","must","at","the","minimum","implement","`","initialize","`","and","`","update","`",":","the","former","builds","the","computational","graph","for","the","algorithm",";","the","latter","runs","the","computational","graph","for","the","algorithm",".","To","reset","inference","(","e.g.",",","internal","variable","counters","incremented","over","training",")",",","fetch","inference","'s","reset","ops","from","session","with","`","sess.run","(","inference.reset",")","`",".","#","#","#","#","Examples","``","`","python","#","Set","up","probability","model",".","mu","=","Normal","(","loc=0.0",",","scale=1.0",")","x","=","Normal","(","loc=mu",",","scale=1.0",",","sample_shape=50",")","#","Set","up","posterior","approximation",".","qmu_loc","=","tf.Variable","(","tf.random_normal","(","[","]",")",")","qmu_scale","=","tf.nn.softplus","(","tf.Variable","(","tf.random_normal","(","[","]",")",")",")","qmu","=","Normal","(","loc=qmu_loc",",","scale=qmu_scale",")","inference","=","ed.Inference","(","{","mu",":","qmu","}",",","data=","{","x",":","tf.zeros","(","50",")","}",")","``","`"]
docstr: A simple wrapper to run inference.
  
  1. Initialize algorithm via `initialize`.
  2. (Optional) Build a TensorFlow summary writer for TensorBoard.
  3. (Optional) Initialize TensorFlow variables.
  4. (Optional) Start queue runners.
  5. Run `update` for `self.n_iter` iterations.
  6. While running, `print_progress`.
  7. Finalize algorithm via `finalize`.
  8. (Optional) Stop queue runners.
  
  To customize the way inference is run, run these steps
  individually.
  
  Args:
    variables: list.
      A list of TensorFlow variables to initialize during inference.
      Default is to initialize all variables (this includes
      reinitializing variables that were already initialized). To
      avoid initializing any variables, pass in an empty list.
    use_coordinator: bool.
      Whether to start and stop queue runners during inference using a
      TensorFlow coordinator. For example, queue runners are necessary
      for batch training with file readers.
    *args, **kwargs:
      Passed into `initialize`.
docstr_tok: ["A","simple","wrapper","to","run","inference",".","1",".","Initialize","algorithm","via","`","initialize","`",".","2",".","(","Optional",")","Build","a","TensorFlow","summary","writer","for","TensorBoard",".","3",".","(","Optional",")","Initialize","TensorFlow","variables",".","4",".","(","Optional",")","Start","queue","runners",".","5",".","Run","`","update","`","for","`","self.n_iter","`","iterations",".","6",".","While","running",",","`","print_progress","`",".","7",".","Finalize","algorithm","via","`","finalize","`",".","8",".","(","Optional",")","Stop","queue","runners",".","To","customize","the","way","inference","is","run",",","run","these","steps","individually",".","Args",":","variables",":","list",".","A","list","of","TensorFlow","variables","to","initialize","during","inference",".","Default","is","to","initialize","all","variables","(","this","includes","reinitializing","variables","that","were","already","initialized",")",".","To","avoid","initializing","any","variables",",","pass","in","an","empty","list",".","use_coordinator",":","bool",".","Whether","to","start","and","stop","queue","runners","during","inference","using","a","TensorFlow","coordinator",".","For","example",",","queue","runners","are","necessary","for","batch","training","with","file","readers",".","*","args",",","*","*","kwargs",":","Passed","into","`","initialize","`","."]
code: def run(self, variables=None, use_coordinator=True, *args, **kwargs):
      """A simple wrapper to run inference.
  
      1. Initialize algorithm via `initialize`.
      2. (Optional) Build a TensorFlow summary writer for TensorBoard.
      3. (Optional) Initialize TensorFlow variables.
      4. (Optional) Start queue runners.
      5. Run `update` for `self.n_iter` iterations.
      6. While running, `print_progress`.
      7. Finalize algorithm via `finalize`.
      8. (Optional) Stop queue runners.
  
      To customize the way inference is run, run these steps
      individually.
  
      Args:
        variables: list.
          A list of TensorFlow variables to initialize during inference.
          Default is to initialize all variables (this includes
          reinitializing variables that were already initialized). To
          avoid initializing any variables, pass in an empty list.
        use_coordinator: bool.
          Whether to start and stop queue runners during inference using a
          TensorFlow coordinator. For example, queue runners are necessary
          for batch training with file readers.
        *args, **kwargs:
          Passed into `initialize`.
      """
      self.initialize(*args, **kwargs)
  
      if variables is None:
          init = tf.global_variables_initializer()
      else:
          init = tf.variables_initializer(variables)
  
      # Feed placeholders in case initialization depends on them.
      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
  
      init.run(feed_dict)
  
      if use_coordinator:
          # Start input enqueue threads.
          self.coord = tf.train.Coordinator()
          self.threads = tf.train.start_queue_runners(coord=self.coord)
  
      for _ in range(self.n_iter):
          info_dict = self.update()
          self.print_progress(info_dict)
  
      self.finalize()
  
      if use_coordinator:
          # Ask threads to stop.
          self.coord.request_stop()
          self.coord.join(self.threads)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import numpy
  import six
  import tensorflow
  import os
  from datetime import datetime
  from edward.models import RandomVariable
  from edward.util import check_data, check_latent_vars, get_session, get_variables, Progbar, transform
  from tensorflow.contrib.distributions import bijectors
label_desc: Use image node_id 2 for calling the Inference obj's underlying member method code with example usage: obj.run(variables, use_coordinator) without return types