code: def gen_read_var_op(var_op, dtype):
      """
      Given a var op, generate the op for reading its value.
  
      Args:
          var_op (Operation): The var op
          dtype (dtype): The dtype of the data to read
  
      Returns:
          Operation: The value-reading operation
      """
      var_op_tensor = var_op.outputs[0]
      if var_op.type == "VarHandleOp":
          result = gen_resource_variable_ops.read_variable_op(
              var_op_tensor, dtype
          )
          _maybe_set_handle_data(dtype, var_op_tensor, result)
          if not context.executing_eagerly():
              # Note that if a control flow context is active the input of the read op
              # might not actually be the handle. This line bypasses it.
              tape.record_operation(
                  "ReadVariableOp",
                  [result],
                  [var_op_tensor],
                  lambda x: [x],
              )
          return result
      elif var_op.type == "VariableV2" or is_read_var_op(var_op):
          return array_ops.identity(var_op_tensor)
      raise ValueError(
          "Can't generate the variable reading tensor from '{}'. "
          "It may not be a proper variable op.".format(var_op.name)
      )
  
file_path: autodist/autodist/kernel/common/variable_utils.py
imports: from tensorflow.python.eager import context, tape
  from tensorflow.python.ops import gen_resource_variable_ops, array_ops
  from tensorflow.python.ops.resource_variable_ops import _maybe_set_handle_data
  from autodist.kernel.common.utils import get_consumers
label_desc: Use image node_id 4 for calling a global function with example usage: gen_read_var_op(var_op, dtype) and returns: result, array_ops