code: def test_module_mode_clear():
      class Model1(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.child1 = torch.nn.Linear(2, 2)
  
      class Model2(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.child2 = torch.nn.Linear(2, 2)
  
      model1 = Model1()
      model2 = Model2()
      mode = _ModuleMode()
      mode.capture(model1)
      assert mode.mode == {"": True, "child1": True}
      mode.capture(model2)
      assert mode.mode == {"": True, "child2": True}
  
file_path: pytorch-lightning/tests/tests_pytorch/utilities/test_model_helpers.py
imports: import logging
  import pytest
  import torch.nn
  from lightning.pytorch import LightningDataModule
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel
  from lightning.pytorch.utilities.model_helpers import _ModuleMode, _restricted_classmethod, is_overridden
  from lightning_utilities import module_available
label_desc: Use image node_id 7 for calling a global function with example usage: test_module_mode_clear() without return types