
    PiG                         U d dl Z d dlmZmZmZ d dlZd dlmZ i Zeee         eej	        j
        egej	        j
        f         f         ed<   d ZdS )    N)CallableDictType)AOBaseConfig_QUANTIZE_CONFIG_HANDLERc                 F     t          j                    fd            }|S )ar  
    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                     | t           <   | S )N)r   )funcconfig_types    y/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchao/quantization/transform_module.py	decoratorz3register_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      s         ' ' ' ' ' ' ' ' ' '  , , , , , ,
  $eho|,eho=>@   ! ! ! ! !r   