code: def run_inside_wrap_function_in_eager_mode(graph_function):
      """Decorator to execute the same graph code in eager and graph modes.
  
      In graph mode, we just execute the graph_function passed as argument. In eager
      mode, we wrap the function using wrap_function and then execute the wrapped
      result.
  
      Args:
        graph_function: python function containing graph code to be wrapped
  
      Returns:
        decorated function
      """
  
      def wrap_and_execute(self):
          if context.executing_eagerly():
              wrapped = wrap_function.wrap_function(
                  graph_function, [self]
              )
              # use the wrapped graph function
              wrapped()
          else:
              # use the original function
              graph_function(self)
  
      return wrap_and_execute
  
imports: from tensorflow.python.eager import context
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import test
  from tensorflow.python.trackable import resource
label_desc: Use image node_id 1 for calling a global function with example usage: run_inside_wrap_function_in_eager_mode(graph_function) and returns: wrap_and_execute