code: def assign_from_values(var_names_to_values):
      """Creates an assignment operation from a given mapping.
  
      This function provides a mechanism for performing assignment of variables
      to values in a way that does not fill the graph with large assignment values.
  
      Args:
        var_names_to_values: A map from variable names to values.
  
      Returns:
        assign_op: An `Operation` that assigns each of the given variables to the
          requested values.
        feed_dict: The feed dictionary to use when evaluating `assign_op`.
  
      Raises:
        ValueError: if any of the given variable names were not found.
      """
      feed_dict = {}
      assign_ops = []
  
      for var_name in var_names_to_values:
          var_value = var_names_to_values[var_name]
          var = ops.get_collection(
              ops.GraphKeys.GLOBAL_VARIABLES, var_name
          )
          if not var:
              raise ValueError("Variable %s wasn't found" % var_name)
          elif len(var) > 1:
              # tf.compat.v1.get_collection is just a filter on the prefix: find the exact match:
              found = False
              for v in var:
                  if v.op.name == var_name:
                      var = v
                      found = True
                      break
  
              if not found:
                  raise ValueError(
                      "Variable %s doesn't uniquely identify a variable"
                      % var_name
                  )
          else:
              var = var[0]
  
          # TODO(nsilberman): ensure placeholder and assign are on the same device.
          # Assign a placeholder to the value that will be filled later.
          placeholder_name = "placeholder/" + var.op.name
          placeholder_value = array_ops.placeholder(
              dtype=var.dtype.base_dtype,
              shape=var.get_shape(),
              name=placeholder_name,
          )
          assign_ops.append(var.assign(placeholder_value))
  
          feed_dict[placeholder_value] = var_value.reshape(
              var.get_shape()
          )
  
      assign_op = control_flow_ops.group(*assign_ops)
      return assign_op, feed_dict
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import re
  from .arg_scope import add_arg_scope
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python import pywrap_tensorflow
  from tensorflow.python.framework import device
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import resource_loader
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import saver
  from tensorflow.python.training import training_util
  from tensorflow.python.util.deprecation import deprecated
label_desc: Use image node_id 19 for calling a global function with example usage: assign_from_values(var_names_to_values) and returns: assign_op,  feed_dict