code: def test_get_absolute_module_key_from_submodule():
      class ParentModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.child_module_1 = ChildModule()
              self.child_module_2 = ChildModule()
  
      class ChildModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.linear = torch.nn.Linear(10, 10)
  
      # the expected module names are those that are relative to the parent module, i.e. "child_module_1.linear.weight"
      parent_module = ParentModule()
      expected_module_names = set()
      for parent_param_name, _ in parent_module.named_parameters():
          expected_module_names.add(parent_param_name)
  
      # incorrect module names are those that are relative to the child module, not the parent module,
      # i.e. "linear.weight" and "linear.bias"
      incorrect_param_names = set()
      for (
          child_param_name,
          _,
      ) in parent_module.child_module_1.named_parameters():
          incorrect_param_names.add(child_param_name)
  
      module_names_child_1 = set(
          get_absolute_module_key_from_submodule(
              parent_module, parent_module.child_module_1
          )
      )
      module_names_child_2 = set(
          get_absolute_module_key_from_submodule(
              parent_module, parent_module.child_module_2
          )
      )
  
      # check that the module names are not equivalent to the incorrect module names
      assert set.isdisjoint(module_names_child_1, incorrect_param_names)
      assert set.isdisjoint(module_names_child_2, incorrect_param_names)
  
      # check that the module names are disjoint from one another because they are relative to the parent module
      assert set.isdisjoint(module_names_child_1, module_names_child_2)
  
      # check that the union of the two sets is equal to the expected module names
      assert (
          set.union(module_names_child_1, module_names_child_2)
          == expected_module_names
      )
  
file_path: ludwig/tests/ludwig/explain/test_util.py
imports: import logging
  import os
  import pandas
  import torch
  from ludwig.api import LudwigModel
  from ludwig.constants import NAME
  from ludwig.explain.util import get_absolute_module_key_from_submodule, replace_layer_with_copy
  from tests.integration_tests.utils import binary_feature, generate_data, LocalTestBackend, text_feature
label_desc: Use image node_id 1 for calling a global function with example usage: test_get_absolute_module_key_from_submodule() without return types