code: def testNestedFunctionsDeleted(self):
      @def_function.function
      def f(x):
          @def_function.function
          def my_sin(x):
              return math_ops.sin(x)
  
          return my_sin(x)
  
      x = constant_op.constant(1.0)
      with backprop.GradientTape() as t1:
          t1.watch(x)
          with backprop.GradientTape() as t2:
              t2.watch(x)
              y = f(x)
          dy_dx = t2.gradient(y, x)
      dy2_dx2 = t1.gradient(dy_dx, x)
  
      self.assertAllClose(0.84147096, y.numpy())  # sin(1.)
      self.assertAllClose(0.54030230, dy_dx.numpy())  # cos(1.)
      self.assertAllClose(-0.84147096, dy2_dx2.numpy())
  
file_path: tensorflow/tensorflow/python/eager/memory_tests/memory_test.py
imports: from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.eager.memory_tests import memory_test_util
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.variables import Variable
label_desc: Use image node_id 3 for calling the MemoryTest obj's underlying member method code with example usage: obj.testNestedFunctionsDeleted() and returns: my_sin, math_ops