
    hG                         % S SK r S SKJrJrJr  S SKrS SKJr  0 r\\\   \\R                  R                  \/\R                  R                  4   4   \S'   S rg)    N)CallableDictType)AOBaseConfig_QUANTIZE_CONFIG_HANDLERc                 F   ^  [         R                  " T 5      U 4S j5       nU$ )a"  
A decorator to register a transform function to map from a workflow
configuration (child of `AOBaseConfig`) to a function that transforms
a `torch.nn.Module` according to the specified configuration.

For example::

    # user facing code
    class WorkflowFooConfig(AOBaseConfig): ...
        # configuration for workflow `Foo` is defined here
        bar = 'baz'

    # non user facing code
    @register_quantize_module_handler(WorkflowFooConfig)
    def _transform(
        mod: torch.nn.Module,
        config: WorkflowFooConfig,
    ) -> torch.nn.Module:
        # the transform is implemented here, usually a tensor sublass
        # weight swap or a module swap
        ...

    # then, the user calls `quantize_` with a config, and `_transform` is called
    # under the hood by `quantize_.

c                    > U [         T'   U $ )N)r   )funcconfig_types    _/home/james-whalen/.local/lib/python3.13/site-packages/torchao/quantization/transform_module.py	decorator3register_quantize_module_handler.<locals>.decorator/   s    04 -    )	functoolswraps)r   r   s   ` r    register_quantize_module_handlerr      s(    8 __[! " r   )r   typingr   r   r   torchtorchao.core.configr   r   nnModule__annotations__r    r   r   <module>r      sa     ' '  ,
  $ehhoo|,ehhoo=>@ !r   