code: def test_constants_with_final(self):
      class M1(torch.nn.Module):
          x: torch.jit.Final[int]
  
          def __init__(self):
              super().__init__()
              self.x = 2
  
          def forward(self, t):
              return t + self.x
  
      self.checkModule(M1(), (torch.randn(2, 2),))
  
      class M2(torch.nn.Module):
          x: typing_extensions.Final[int]
  
          def __init__(self):
              super().__init__()
              self.x = 2
  
          def forward(self, t):
              return t + self.x
  
      self.checkModule(M2(), (torch.randn(2, 2),))
  
      class M3(torch.nn.Module):
          x: typing.Final[int]
  
          def __init__(self):
              super().__init__()
              self.x = 2
  
          def forward(self, t):
              return t + self.x
  
      self.checkModule(M3(), (torch.randn(2, 2),))
  
imports: import os
  import re
  import sys
  import types
  import typing
  import typing_extensions
  from typing import List, Dict, Optional, Tuple
  import torch
  import torch.jit.frontend
  import torch.nn
  from torch import Tensor
  from torch.testing import FileCheck
  from collections import OrderedDict
  from torch.testing._internal.jit_utils import JitTestCase, _tmp_donotuse_dont_inline_everything
label_desc: Use image node_id 9 for calling the TestRecursiveScript obj's underlying member method code with example usage: obj.test_constants_with_final() and returns: unknown, unknown, unknown