code: def test_invalidation(self):
      @torch.jit.script
      def test_invalidation_fn(x: torch.Tensor):
          return 2 * x
  
      gr = test_invalidation_fn.graph.copy()
      n = gr.insertNode(gr.create("prim::profile"))
      v = n.output()
      # check that they work
      str((n, v))
      torch._C._jit_pass_dce(gr)
      with self.assertRaisesRegex(RuntimeError, "invalidated"):
          str(n)
      with self.assertRaisesRegex(RuntimeError, "invalidated"):
          str(v)
  
file_path: pytorch/test/jit/test_python_bindings.py
imports: import torch
  from torch.testing import FileCheck
  from torch.testing._internal.jit_utils import JitTestCase
label_desc: Use image node_id 3 for calling the TestPythonBindings obj's underlying member method code with example usage: obj.test_invalidation() and returns: unknown