code: def test_weak_tensor_in_restored_function(self):
      class CustomModule(module.Module):
          @def_function.function
          def __call__(self, x):
              if isinstance(x, tensor.Tensor):
                  raise TypeError(
                      "Weak tensor should not be tensor.Tensor type."
                  )
              return x
  
      m = CustomModule()
      a = WeakTensor.from_tensor(constant_op.constant(1, dtypes.int32))
      _ = m(a)
  
      save(m, "/tmp/f")
      m_loaded = load("/tmp/f")
      res = m_loaded(a)
      self.assertIsInstance(res, WeakTensor)
  
      b = constant_op.constant(1, dtypes.int32)
      with self.assertRaisesRegex(
          ValueError, "Could not find matching concrete function"
      ):
          m_loaded(b)
  
imports: import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import extension_type
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.framework.weak_tensor import EagerWeakTensor
  from tensorflow.python.framework.weak_tensor import GraphWeakTensor
  from tensorflow.python.framework.weak_tensor import WeakTensor
  from tensorflow.python.module import module
  from tensorflow.python.platform import googletest
  from tensorflow.python.saved_model.load import load
  from tensorflow.python.saved_model.save import save
  from tensorflow.python.types import core
label_desc: Use image node_id 11 for calling the WeakTensorTest obj's underlying member method code with example usage: obj.test_weak_tensor_in_restored_function() and returns: x