class_docstr: A configuration wrapper that enables fine-grained control when compressing a model,
  Providing the following levels: `global`, `op type`, and `op name`.
  
  1. ``global_config``: The default configuration applied to all ops / consts.
  2. ``op_type_configs``: Configurations applied to specific op type. It overrides ``global_config``.
  3. ``op_name_configs``: Configurations applied to specific constant or op instance. It overrides ``global_config`` and ``op_type_configs``.
  
  The following is an example that constructs an optimization config for weight palettization.
  
      .. code-block:: python
  
          from coremltools.optimize.coreml import OpPalettizerConfig, OptimizationConfig
  
          # The default global configuration is 8 bits palettization with kmeans
          global_config = OpPalettizerConfig(mode="kmeans", nbits=8)
  
          # We use 2 bits palettization for convolution layers, and skip the compression for linear layers
          op_type_configs = {
              "conv": OpPalettizerConfig(mode="kmeans", nbits=2),
              "linear": None,
          }
  
          # We want a convolution layer named "conv_1" to have a 4 bits palettization with a different mode
          op_name_configs = {
              "conv_1": OpPalettizerConfig(mode="uniform", nbits=4),
          }
  
          # Now we can put all configuration across three levels to construct an OptimizationConfig object
          config = OptimizationConfig(
              global_config=global_config,
              op_type_configs=op_type_configs,
              op_name_configs=op_name_configs,
          )
  
  
  Parameters
  ----------
  
  global_config: OpCompressorConfig
      Config to be applied globally to all supported ops.
  
  op_type_configs: dict[str, OpCompressorConfig]
      Op type level configs applied to a specific op class.
  
      * The keys of the dictionary are the string of the op type, and the values are the corresponding :py:class:`OpCompressorConfig`.
      * An op type will not be compressed if the value is set to ``None``.
  
  op_name_configs: dict[str, OpCompressorConfig]
      Op instance level configs applied to a specific constant or op.
  
      * The keys of the dictionary are the name of a constant or an op instance, and the values are the corresponding :py:class:`OpCompressorConfig`.
      * An op instance will not be compressed if the value is set to ``None``.
      * You can use ``coremltools.optimize.coreml.get_weights_metadata`` to get the name of the constants / op instances in the model.
class_docstr_tok: ["A","configuration","wrapper","that","enables","fine-grained","control","when","compressing","a","model",",","Providing","the","following","levels",":","`","global","`",",","`","op","type","`",",","and","`","op","name","`",".","1",".","``","global_config","``",":","The","default","configuration","applied","to","all","ops","\/","consts",".","2",".","``","op_type_configs","``",":","Configurations","applied","to","specific","op","type",".","It","overrides","``","global_config","``",".","3",".","``","op_name_configs","``",":","Configurations","applied","to","specific","constant","or","op","instance",".","It","overrides","``","global_config","``","and","``","op_type_configs","``",".","The","following","is","an","example","that","constructs","an","optimization","config","for","weight","palettization",".","..","code-block",":",":","python","from","coremltools.optimize.coreml","import","OpPalettizerConfig",",","OptimizationConfig","#","The","default","global","configuration","is","8","bits","palettization","with","kmeans","global_config","=","OpPalettizerConfig","(","mode=","''","kmeans","''",",","nbits=8",")","#","We","use","2","bits","palettization","for","convolution","layers",",","and","skip","the","compression","for","linear","layers","op_type_configs","=","{","``","conv","''",":","OpPalettizerConfig","(","mode=","''","kmeans","''",",","nbits=2",")",",","``","linear","''",":","None",",","}","#","We","want","a","convolution","layer","named","``","conv_1","''","to","have","a","4","bits","palettization","with","a","different","mode","op_name_configs","=","{","``","conv_1","''",":","OpPalettizerConfig","(","mode=","''","uniform","''",",","nbits=4",")",",","}","#","Now","we","can","put","all","configuration","across","three","levels","to","construct","an","OptimizationConfig","object","config","=","OptimizationConfig","(","global_config=global_config",",","op_type_configs=op_type_configs",",","op_name_configs=op_name_configs",",",")","Parameters","--","--","--","--","--","global_config",":","OpCompressorConfig","Config","to","be","applied","globally","to","all","supported","ops",".","op_type_configs",":","dict","[","str",",","OpCompressorConfig","]","Op","type","level","configs","applied","to","a","specific","op","class",".","*","The","keys","of","the","dictionary","are","the","string","of","the","op","type",",","and","the","values","are","the","corresponding",":","py",":","class",":","`","OpCompressorConfig","`",".","*","An","op","type","will","not","be","compressed","if","the","value","is","set","to","``","None","``",".","op_name_configs",":","dict","[","str",",","OpCompressorConfig","]","Op","instance","level","configs","applied","to","a","specific","constant","or","op",".","*","The","keys","of","the","dictionary","are","the","name","of","a","constant","or","an","op","instance",",","and","the","values","are","the","corresponding",":","py",":","class",":","`","OpCompressorConfig","`",".","*","An","op","instance","will","not","be","compressed","if","the","value","is","set","to","``","None","``",".","*","You","can","use","``","coremltools.optimize.coreml.get_weights_metadata","``","to","get","the","name","of","the","constants","\/","op","instances","in","the","model","."]
code: def check_global_configs(self, attr, global_config):
      if global_config is None:
          return
      self._check_op_config_type(global_config)
  
imports: import sys
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from typing import IO, Any, Callable, Dict, Optional, Tuple, Union
  import cattrs
  import numpy
  import yaml
  from attrs import define, field, validators
  from coremltools.converters.mil.mil import Operation, types
  from coremltools.converters.mil.mil.types.type_mapping import is_builtin, numpy_type_to_builtin_type
label_desc: Use image node_id 8 for calling the OptimizationConfig obj's underlying member method code with example usage: obj.check_global_configs(attr, global_config) without return types