U
    yhI                     @   s*   d dl Z dgZG dd de jjjjZdS )    NLSTMc                   @   s<   e Zd ZdZejjjjZ	dd Z
edd Zedd ZdS )	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)
    c                 C   s   dS )NZQuantizedLSTM )selfr   r   S/var/www/html/venv/lib/python3.8/site-packages/torch/ao/nn/quantized/modules/rnn.py	_get_name#   s    zLSTM._get_namec                 O   s   t dd S )NzrIt looks like you are trying to convert a non-observed LSTM module. Please, see the examples on quantizable LSTMs.)NotImplementedError)clsargskwargsr   r   r   
from_float&   s    zLSTM.from_floatc                 C   s0   t || jksttjjj|ddd}| |_|S )NFT)ZinplaceZremove_qconfig)type_FLOAT_MODULEAssertionErrortorchaoZquantizationconvert	__class__)r   otherZ	convertedr   r   r   from_observed.   s    zLSTM.from_observedN)__name__
__module____qualname____doc__r   r   nnquantizabler   r   r   classmethodr   r   r   r   r   r   r      s   
)r   __all__r   r   r   r   r   r   r   r   <module>   s   