code: def construct_modulelist_from_single_module(
      module: torch.nn.Module, sizes: Tuple[int, ...]
  ) -> torch.nn.Module:
      """
      Given a single module, construct a (nested) ModuleList of size of sizes by making
      copies of the provided module and reinitializing the Linear layers.
      """
      if len(sizes) == 1:
          return torch.nn.ModuleList(
              [
                  copy.deepcopy(module).apply(
                      init_mlp_weights_xavier_uniform
                  )
                  for _ in range(sizes[0])
              ]
          )
      else:
          # recursively create nested ModuleList
          return torch.nn.ModuleList(
              [
                  construct_modulelist_from_single_module(
                      module, sizes[1:]
                  )
                  for _ in range(sizes[0])
              ]
          )
  
file_path: torchrec/torchrec/modules/utils.py
imports: import copy
  from typing import Callable, Iterable, Tuple, Union
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: construct_modulelist_from_single_module(module, sizes) and returns: torch, torch