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: Log variables to TensorBoard.
  
  For each variable in `log_vars`, forms a `tf.summary.scalar` if
  the variable has scalar shape; otherwise forms a `tf.summary.histogram`.
  
  Args:
    log_vars: list.
      Specifies the list of variables to log after each `n_print`
      steps. If None, will log all variables. If `[]`, no variables
      will be logged.
docstr_tok: ["Log","variables","to","TensorBoard",".","For","each","variable","in","`","log_vars","`",",","forms","a","`","tf.summary.scalar","`","if","the","variable","has","scalar","shape",";","otherwise","forms","a","`","tf.summary.histogram","`",".","Args",":","log_vars",":","list",".","Specifies","the","list","of","variables","to","log","after","each","`","n_print","`","steps",".","If","None",",","will","log","all","variables",".","If","`","[","]","`",",","no","variables","will","be","logged","."]
code: def _set_log_variables(self, log_vars=None):
      """Log variables to TensorBoard.
  
      For each variable in `log_vars`, forms a `tf.summary.scalar` if
      the variable has scalar shape; otherwise forms a `tf.summary.histogram`.
  
      Args:
        log_vars: list.
          Specifies the list of variables to log after each `n_print`
          steps. If None, will log all variables. If `[]`, no variables
          will be logged.
      """
      if log_vars is None:
          log_vars = []
          for key in six.iterkeys(self.data):
              log_vars += get_variables(key)
  
          for key, value in six.iteritems(self.latent_vars):
              log_vars += get_variables(key)
              log_vars += get_variables(value)
  
          log_vars = set(log_vars)
  
      for var in log_vars:
          # replace colons which are an invalid character
          var_name = var.name.replace(":", "/")
          # Log all scalars.
          if len(var.shape) == 0:
              tf.summary.scalar(
                  "parameter/{}".format(var_name),
                  var,
                  collections=[self._summary_key],
              )
          elif len(var.shape) == 1 and var.shape[0] == 1:
              tf.summary.scalar(
                  "parameter/{}".format(var_name),
                  var[0],
                  collections=[self._summary_key],
              )
          else:
              # If var is multi-dimensional, log a histogram of its values.
              tf.summary.histogram(
                  "parameter/{}".format(var_name),
                  var,
                  collections=[self._summary_key],
              )
  
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 7 for calling the Inference obj's underlying member method code with example usage: obj._set_log_variables(log_vars) without return types