def _validate_same_params(self, param_names: _List[str]):
        """
        This method validates that all the parameters in param_names
        have the same value across all the module level configs.
        """
        expected_values = None
        if self.global_config is not None:
            expected_values = {
                param_name: getattr(self.global_config, param_name) for param_name in param_names
            }
        for name, config in self.module_type_configs.items():
            if config is not None:
                expected_values = self._validate_expected_value(
                    expected_values, name, config, param_names
                )
        for name, config in self.module_name_configs.items():
            if config is not None:
                expected_values = self._validate_expected_value(
                    expected_values, name, config, param_names
                )

        This method validates that all the parameters in param_names
        have the same value across all the module level configs.
        
coremltools/optimize/torch/optimization_config.py