
    pij                         d dl mZ d dlZdgZ G d dej                  j
                  j                  j                        Zy)    )AnyNLSTMc                      e Zd ZdZej
                  j                  j                  j                  Z	de
fdZedededdfd       Zeded    d	ej
                  j                  j                  j                  dd fd
       Zy)r   ar  A quantized long short-term memory (LSTM).

    For the description and the argument types, please, refer to :class:`~torch.nn.LSTM`

    Attributes:
        layers : instances of the `_LSTMLayer`

    .. note::
        To access the weights and biases, you need to access them per layer.
        See examples in :class:`~torch.ao.nn.quantizable.LSTM`

    Examples::
        >>> # xdoctest: +SKIP
        >>> custom_module_config = {
        ...     'float_to_observed_custom_module_class': {
        ...         nn.LSTM: nn.quantizable.LSTM,
        ...     },
        ...     'observed_to_quantized_custom_module_class': {
        ...         nn.quantizable.LSTM: nn.quantized.LSTM,
        ...     }
        ... }
        >>> tq.prepare(model, prepare_custom_module_class=custom_module_config)
        >>> tq.convert(model, convert_custom_module_class=custom_module_config)
    returnc                      y)NQuantizedLSTM )selfs    c/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/torch/ao/nn/quantized/modules/rnn.py	_get_namezLSTM._get_name'   s        argskwargsNc                     t        d      )NzrIt looks like you are trying to convert a non-observed LSTM module. Please, see the examples on quantizable LSTMs.)NotImplementedError)clsr   r   s      r   
from_floatzLSTM.from_float*   s     "1
 	
r   r   otherc                     t        || j                        sJ t        j                  j                  j                  |dd      }| |_        |S )NFT)inplaceremove_qconfig)
isinstance_FLOAT_MODULEtorchaoquantizationconvert	__class__)r   r   	converteds      r   from_observedzLSTM.from_observed4   sN    %!2!2333HH))115 2 
	 "	r   )__name__
__module____qualname____doc__r   r   nnquantizabler   r   strr   classmethodr   r   typer    r	   r   r   r   r      s    2 HHKK++00M3  
s 
c 
d 
 
 4< 0G0G0L0L QW  r   )typingr   r   __all__r   r%   r&   r   r	   r   r   <module>r,      s7      
0588;;""'' 0r   