code: def assign_on_each_device(var, assign_func, value, read_value):
      """Update the variable on each replica with the given assign_func and value."""
      if (
          var._packed_variable is not None
      ):  # pylint: disable=protected-access
          update = control_flow_ops.group(
              tuple(
                  assign_func(d, var._packed_variable, value)
                  for d in var._devices
              )
          )  # pylint: disable=protected-access
      else:
          update = control_flow_ops.group(
              tuple(
                  assign_func(v.device, v, value) for v in var._values
              )
          )  # pylint: disable=protected-access
      if not read_value:
          return update
      with ops.control_dependencies([update] if update else []):
          return var.read_value()
  
imports: from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import reduce_util
  from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.saved_model import save_context
  from tensorflow.python.saved_model import save_options
  from tensorflow.python.training.saving import saveable_object
label_desc: Use image node_id 10 for calling a global function with example usage: assign_on_each_device(var, assign_func, value, read_value) and returns: update, var