class_docstr: Restore variables from a dictionary.
class_docstr_tok: ["Restore","variables","from","a","dictionary","."]
code: def _run_init(self, sess):
      variables = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES)
      variable_names_list = [k.name for k in variables]
  
      variable_names = set(variable_names_list)
      param_names = set(six.iterkeys(self._prms))
  
      # intersect has the original ordering of variables
      intersect = [v for v in variable_names_list if v in param_names]
  
      # use opname (without :0) for clarity in logging
      logger.info(
          "Variables to restore from dict: {}".format(
              ", ".join(get_op_tensor_name(x)[0] for x in intersect)
          )
      )
  
      mismatch = MismatchLogger("graph", "dict")
      for k in sorted(variable_names - param_names):
          if not is_training_name(k):
              mismatch.add(k)
      mismatch.log()
      mismatch = MismatchLogger("dict", "graph")
      for k in sorted(param_names - variable_names):
          mismatch.add(k)
      mismatch.log()
  
      upd = SessionUpdate(
          sess,
          [v for v in variables if v.name in intersect],
          ignore_mismatch=self._ignore_mismatch,
      )
      logger.info(
          "Restoring {} variables from dict ...".format(len(intersect))
      )
      upd.update(
          {
              name: value
              for name, value in six.iteritems(self._prms)
              if name in intersect
          }
      )
  
imports: import os
  import numpy
  import six
  from ..compat import tfv1
  from ..utils import logger
  from .common import get_op_tensor_name
  from .varmanip import SessionUpdate, get_checkpoint_path, get_savename_from_varname, is_training_name
label_desc: Use image node_id 2 for calling the DictRestore obj's underlying member method code with example usage: obj._run_init(sess) without return types