def enter_module(
        self,
        module: ScriptModule,
        hierarchy: List[str],
        name: str,
        graph: torch._C.Graph,
    ):
        """
        Enters a module context and annotates its graph.

        Parameters
        ----------
        hierarchy : List[str]
            The hierarchical path of the module.

        name : str
            The name of the module.

        graph : _TorchGraph
            The module graph.
        """

        input_names = [input.debugName() for input in graph.inputs()]

        call_sequence = self._get_module_call_sequence(
            hierarchy=hierarchy,
        )

        self._annotate_graph(graph=graph)

        module_info = TorchScriptModuleInfo(
            name=name,
            hierarchy=tuple(hierarchy),
            output_names=(),
            input_names=tuple(input_names),
            call_sequence=call_sequence,
            code=module.code,
            submodules=(),
        )

        self._create_node_infos(
            module_key=module_info.key,
            graph=graph,
        )

        self._module_infos.append(module_info)
        self._graphs.append(graph)

        Enters a module context and annotates its graph.

        Parameters
        ----------
        hierarchy : List[str]
            The hierarchical path of the module.

        name : str
            The name of the module.

        graph : _TorchGraph
            The module graph.
        
coremltools/models/ml_program/experimental/torch/debugging_utils.py