async def benchmark_module_execution(
        self,
        inputs: Optional[Dict[str, Any]] = None,
        iterations: int = 1,
        warmup: bool = False,
    ) -> List[ModuleExecutionInfo]:
        """
        Measures the execution time of modules in the PyTorch model.

        This method loads the converted model, runs predictions, and retrieves the execution time
        of each operation within the model.

        Parameters
        ----------
        inputs : Optional[Dict[str, Any]]
            The input data for the model prediction. If None, random input data will be generated.

        iterations: int
            The number of prediction iterations to run. Defaults to 1.

        warmup: bool
            Whether to perform a warmup iteration. Defaults to False.

        Returns
        -------
        List[TorchModuleExecutionInfo]
            A list of ``TorchModuleExecutionInfo`` objects, each containing
            details about an modules's execution, sorted by execution time in descending order.

        Notes
        -----
        - The returned list is sorted by execution time, with the most time-consuming operations first.
        - Execution times are estimated based on the overall prediction time and the converted model's compute plan.
        """
        source_operation_execution_infos = await self.benchmark_node_execution(
            inputs=inputs,
            iterations=iterations,
            warmup=warmup,
        )

        source_module_execution_infos = {}
        for source_operation_execution_info in source_operation_execution_infos:
            source_node = source_operation_execution_info.node
            module_names = TorchMLModelBenchmarker.get_module_names(source_node)
            if module_names is None:
                continue

            for module_name in module_names:
                source_module_execution_info = source_module_execution_infos.get(
                    module_name,
                    TorchMLModelBenchmarker.ModuleExecutionInfo.from_name(name=module_name),
                )

                source_module_execution_info.ops.append(source_operation_execution_info)
                source_module_execution_info.measurement = (
                    source_module_execution_info.measurement.add_samples(
                        samples=source_operation_execution_info.measurement.samples,
                    )
                )

                source_module_execution_infos[module_name] = source_module_execution_info

        result = list(source_module_execution_infos.values())
        return sorted(result, key=lambda value: value.measurement.sort_key, reverse=True)

        Measures the execution time of modules in the PyTorch model.

        This method loads the converted model, runs predictions, and retrieves the execution time
        of each operation within the model.

        Parameters
        ----------
        inputs : Optional[Dict[str, Any]]
            The input data for the model prediction. If None, random input data will be generated.

        iterations: int
            The number of prediction iterations to run. Defaults to 1.

        warmup: bool
            Whether to perform a warmup iteration. Defaults to False.

        Returns
        -------
        List[TorchModuleExecutionInfo]
            A list of ``TorchModuleExecutionInfo`` objects, each containing
            details about an modules's execution, sorted by execution time in descending order.

        Notes
        -----
        - The returned list is sorted by execution time, with the most time-consuming operations first.
        - Execution times are estimated based on the overall prediction time and the converted model's compute plan.
        
coremltools/models/ml_program/experimental/torch/perf_utils.py