1# Owner(s): ["oncall: mobile"] 2 3import torch 4from test.jit.fixtures_srcs.generate_models import ALL_MODULES 5from torch.testing._internal.common_utils import run_tests, TestCase 6 7 8class TestUpgraderModelGeneration(TestCase): 9 def test_all_modules(self): 10 for a_module in ALL_MODULES.keys(): 11 module_name = type(a_module).__name__ 12 self.assertTrue( 13 isinstance(a_module, torch.nn.Module), 14 f"The module {module_name} " 15 f"is not a torch.nn.module instance. " 16 f"Please ensure it's a subclass of torch.nn.module in fixtures_src.py" 17 f"and it's registered as an instance in ALL_MODULES in generated_models.py", 18 ) 19 20 21if __name__ == "__main__": 22 run_tests() 23