code: def test_namedtuple_error_source_attribution(self):
      class _NamedTupleBadMemberType(NamedTuple):
          f1: torch.Tensor
          f2: "ABadForwardRefType"  # noqa: F821
  
      make_global(
          _NamedTupleBadMemberType
      )  # see [local resolution in python]
  
      def fn(x: _NamedTupleBadMemberType) -> torch.Tensor:
          return x.f1.relu()
  
      # assert that this has a location associated with the error.
      # note the " +" is regex (i.e. "at least one space")
      with self.assertRaisesRegex(ValueError, "at +File"):
          torch.jit.script(fn)
  
imports: import os
  import sys
  import torch
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  from torch.testing._internal.common_utils import IS_WINDOWS
  from collections import namedtuple
  from typing import List, Tuple, Dict, NamedTuple
label_desc: Use image node_id 39 for calling the TestTyping obj's underlying member method code with example usage: obj.test_namedtuple_error_source_attribution() and returns: x