code: def build_weight_sharing_dependency(
      graph_module: torch.fx.GraphModule,
  ) -> List[List[str]]:
      """
      This model analyze the weight sharing dependencies between the conv
      layers in a model. (e.g. different node refer to same module)
  
      Parameters
      ----------
      graph_module : torch.fx.GraphModule
          The target graph and module.
  
      Returns
      -------
      dependency : List
          The weight sharing dependency for the target graph.
      """
  
      dependency = {}
      target_types = [
          torch.nn.Conv2d,
          torch.nn.Linear,
          torch.nn.ConvTranspose2d,
          torch.nn.Embedding,
      ]
      for node in graph_module.graph.nodes:
          if node.op == "call_module":
              target_module = graph_module.get_submodule(node.target)
              if isinstance(target_module, tuple(target_types)):
                  dependency[node.target] = dependency.get(
                      node.target, []
                  ) + [node]
      return [dep for dep in dependency.values() if len(dep) > 1]
  
file_path: nni/nni/compression/speedup/dependency.py
imports: import logging
  import operator
  from copy import deepcopy
  from typing import Any, Dict, List, Set
  from uuid import uuid4
  import numpy
  import torch
  import torch.fx
  from torch.fx.passes.shape_prop import TensorMetadata
  from nni.compression.base.config import trans_legacy_config_list, select_modules_by_config
label_desc: Use image node_id 7 for calling a global function with example usage: build_weight_sharing_dependency(graph_module) and returns: unknown