code: def testVariableLifting(self):
      save_prefix = os.path.join(self.get_temp_dir(), "meta_graph_test")
  
      export_graph = ops.Graph()
      with export_graph.as_default():
          v = variables.Variable(1.0)
          array_ops.identity(v + 1.0, name="output")
          saver = saver_lib.Saver([v])
          with self.test_session() as session:
              session.run(v.initializer)
              saver.save(session, save_prefix)
  
      def importer():
          saver_lib.import_meta_graph(save_prefix + ".meta")
          return ops.get_default_graph().as_graph_element("output:0")
  
      wrapped = wrap_function.wrap_function(importer, [])
      lifted_variables = list(wrapped.graph.variables)
      self.assertLen(lifted_variables, 1)
      initializer = wrapped.prune(
          [], wrapped.graph.as_graph_element(v.initializer.name)
      )
      self.assertEqual(
          lifted_variables, list(initializer.graph.variables)
      )
      self.assertEqual(
          initializer.graph.external_captures,
          wrapped.graph.external_captures,
      )
  
      @def_function.function
      def wraps_initializer():
          initializer()
  
      wraps_initializer()
      self.assertEqual(1.0, lifted_variables[0].numpy())
      wrapped_initializer_graphdef = (
          wraps_initializer.get_concrete_function().graph.as_graph_def()
      )
      self._assert_single_captured_variable_argument(
          wrapped_initializer_graphdef
      )
  
      @def_function.function
      def wraps_wrapped():
          return wrapped()
  
      # Verify that the original graph also has the correct signature.
      wrapped_wrapped_graphdef = (
          wraps_wrapped.get_concrete_function().graph.as_graph_def()
      )
      self._assert_single_captured_variable_argument(
          wrapped_wrapped_graphdef
      )
      # Now check that the graph runs wrapped, from eager, and when pruned.
      self.assertAllEqual(
          wraps_wrapped().numpy(), lifted_variables[0].numpy() + 1.0
      )
      self.assertAllEqual(
          wrapped().numpy(), lifted_variables[0].numpy() + 1.0
      )
      pruned = wrapped.prune(
          [], wrapped.graph.as_graph_element("output:0")
      )
      self.assertAllEqual(wrapped().numpy(), pruned().numpy())
  
imports: import os
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import state_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
  from tensorflow.python.training import saver
label_desc: Use image node_id 5 for calling the WrapFunctionTest obj's underlying member method code with example usage: obj.testVariableLifting() and returns: ops, wrapped