code: def test_generate_mobile_module_lints(self):
      class MyTestModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.fc = torch.nn.Linear(4, 4)
              self.dropout = torch.nn.Dropout(p=0.5)
  
          def forward(self, inputs):
              out = self.fc(inputs)
              out = self.dropout(out)
              return out
  
      class MyBNModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.bn = torch.nn.BatchNorm2d(4, affine=True)
  
          def forward(self, inputs):
              bn = self.bn(inputs)
              return bn
  
      class MyBundledInputModule(torch.nn.Module):
          def forward(self, inputs):
              return inputs
  
      def get_lint_count_by_type(lint_type, module_lint_List):
          return len(
              [
                  lint_dict
                  for lint_dict in module_lint_List
                  if lint_dict["name"] == lint_type.name
              ]
          )
  
      test_module = torch.jit.script(MyTestModule())
      test_module_lint_list = generate_mobile_module_lints(test_module)
      self.assertEqual(len(test_module_lint_list), 4)
      self.assertEqual(
          get_lint_count_by_type(
              LintCode.BUNDLED_INPUT, test_module_lint_list
          ),
          1,
      )
      self.assertEqual(
          get_lint_count_by_type(
              LintCode.DROPOUT, test_module_lint_list
          ),
          1,
      )
      self.assertEqual(
          get_lint_count_by_type(
              LintCode.REQUIRES_GRAD, test_module_lint_list
          ),
          2,
      )
  
      bn_module = torch.jit.script(MyBNModule())
      bn_module_lint_list = generate_mobile_module_lints(bn_module)
      self.assertEqual(len(bn_module_lint_list), 4)
      self.assertEqual(
          get_lint_count_by_type(
              LintCode.BUNDLED_INPUT, bn_module_lint_list
          ),
          1,
      )
      self.assertEqual(
          get_lint_count_by_type(
              LintCode.BATCHNORM, bn_module_lint_list
          ),
          1,
      )
      self.assertEqual(
          get_lint_count_by_type(
              LintCode.REQUIRES_GRAD, bn_module_lint_list
          ),
          2,
      )
  
      bi_module = torch.jit.script(MyBundledInputModule())
      torch.utils.bundled_inputs.augment_model_with_bundled_inputs(
          bi_module, [(torch.tensor([1]),)], []
      )
      bi_module_lint_list = generate_mobile_module_lints(bi_module)
      self.assertEqual(len(bi_module_lint_list), 0)
  
file_path: pytorch/test/test_mobile_optimizer.py
imports: import unittest
  import torch
  import torch.nn
  import torch.utils.bundled_inputs
  from torch.testing._internal.common_utils import TestCase, run_tests, skipIfNoXNNPACK
  from torch.testing._internal.jit_utils import get_forward, get_forward_graph
  from torch.utils.mobile_optimizer import LintCode, generate_mobile_module_lints, optimize_for_mobile, MobileOptimizerType
  from torch.nn import functional
  from torch.testing._internal.common_quantized import override_quantized_engine
label_desc: Use image node_id 3 for calling the TestOptimizer obj's underlying member method code with example usage: obj.test_generate_mobile_module_lints() and returns: len, out, bn, inputs