code: def test_capture_in_nested_function(self):
      x = constant_op.constant(1)
  
      @def_function.function
      def f():
          graph = ops.get_default_graph()
          # Capture the same x for the outer tf.function
          graph._experimental_capture_side_input_by_ref("x", lambda: x)
  
          @def_function.function
          def g():
              graph = ops.get_default_graph()
              cap_x = graph._experimental_capture_side_input_by_ref(
                  "xx", lambda: x
              )
              return cap_x + 100
  
          return g()
  
      self.assertEqual(f(), 2)
      x = constant_op.constant(2)
      self.assertEqual(f(), 102)
  
file_path: tensorflow-upstream/tensorflow/core/function/capture/by_ref_capture_test.py
imports: import unittest
  from absl.testing import parameterized
  from tensorflow.python.compat import v2_compat
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the ByRefCaptureTest obj's underlying member method code with example usage: obj.test_capture_in_nested_function() and returns: g, unknown