code: def check_latent_vars(latent_vars):
      """Check that the latent variable dictionary passed during inference and
      criticism is valid.
      """
      if not isinstance(latent_vars, dict):
          raise TypeError("latent_vars must have type dict.")
  
      for key, value in six.iteritems(latent_vars):
          if not isinstance(key, (RandomVariable, tf.Tensor)):
              raise TypeError(
                  "Latent variable key has an invalid type: "
                  "{}".format(type(key))
              )
          elif not isinstance(value, (RandomVariable, tf.Tensor)):
              raise TypeError(
                  "Latent variable value has an invalid type: "
                  "{}".format(type(value))
              )
          elif not key.shape.is_compatible_with(value.shape):
              raise TypeError(
                  "Key-value pair in latent_vars does not have same "
                  "shape: {}, {}".format(key.shape, value.shape)
              )
          elif key.dtype != value.dtype:
              raise TypeError(
                  "Key-value pair in latent_vars does not have same "
                  "dtype: {}, {}".format(key.dtype, value.dtype)
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import six
  import tensorflow
  from copy import deepcopy
  from edward.models.random_variable import RandomVariable
  from edward.models.random_variables import TransformedDistribution
  from edward.models import PointMass
  from edward.util.graphs import random_variables
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.python.framework.ops import set_shapes_for_outputs
  from tensorflow.python.util import compat
label_desc: Use image node_id 2 for calling a global function with example usage: check_latent_vars(latent_vars) without return types