§
    �Štj  ã                   óV   — d Z ddlmZ  G d„ d¦  «        Z G d„ dej        ¦  «        ZdS )z3Functionality for Python <-> C++ frontend inter-op.é    )Únnc                   óf   — e Zd ZdZdd„Zed„ ¦   «         Zd„ Zd„ Zd„ Z	d	„ Z
defd
„Zdefd„Zd„ ZdS )ÚOrderedDictWrappera¥  A wrapper around a C++ OrderedDict.

    It dynamically evaluates the OrderedDict getter on a bound C++ module, such
    that new changes on the C++ side are picked up. Otherwise accessing e.g.
    ``cpp_module._parameters`` just once would get a frozen copy of the parameters
    at the time of access. ``torch.nn.Module`` accesses ``_parameters`` et al. via ``self.__dict__``
    so using properties does not work.
    ÚreturnNc                 ó"   — || _         || _        d S ©N)Ú
cpp_moduleÚattr)Úselfr	   r
   s      úJ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/torch/nn/cpp.pyÚ__init__zOrderedDictWrapper.__init__   s   € Ø$ˆŒØˆŒ	ˆ	ˆ	ó    c                 ó6   — t          | j        | j        ¦  «        S r   )Úgetattrr	   r
   ©r   s    r   Úcpp_dictzOrderedDictWrapper.cpp_dict   s   € å�t”¨¬	Ñ2Ô2Ð2r   c                 ó4   — | j                              ¦   «         S r   )r   Úitemsr   s    r   r   zOrderedDictWrapper.items   s   € ØŒ}×"Ò"Ñ$Ô$Ð$r   c                 ó4   — | j                              ¦   «         S r   )r   Úkeysr   s    r   r   zOrderedDictWrapper.keys   s   € ØŒ}×!Ò!Ñ#Ô#Ð#r   c                 ó4   — | j                              ¦   «         S r   )r   Úvaluesr   s    r   r   zOrderedDictWrapper.values"   s   € ØŒ}×#Ò#Ñ%Ô%Ð%r   c                 ó4   — | j                              ¦   «         S r   )r   Ú__iter__r   s    r   r   zOrderedDictWrapper.__iter__%   s   € ØŒ}×%Ò%Ñ'Ô'Ð'r   c                 ó4   — | j                              ¦   «         S r   )r   Ú__len__r   s    r   r   zOrderedDictWrapper.__len__(   s   € ØŒ}×$Ò$Ñ&Ô&Ð&r   c                 ó6   — | j                              |¦  «        S r   )r   Ú__contains__©r   Úkeys     r   r   zOrderedDictWrapper.__contains__+   s   € ØŒ}×)Ò)¨#Ñ.Ô.Ð.r   c                 ó6   — | j                              |¦  «        S r   )r   Ú__getitem__r   s     r   r"   zOrderedDictWrapper.__getitem__.   s   € ØŒ}×(Ò(¨Ñ-Ô-Ð-r   ©r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   r   r   r   r   Úintr   Úboolr   r"   © r   r   r   r      sÎ   € € € € € ðð ðð ð ð ð ð3ð 3ñ „Xð3ð%ð %ð %ð$ð $ð $ð&ð &ð &ð(ð (ð (ð'˜ð 'ð 'ð 'ð 'ð/ 4ð /ð /ð /ð /ð.ð .ð .ð .ð .r   r   c                   óp   ‡ — e Zd ZdZd
ˆ fd„Zdd„Zed„ ¦   «         Zej        d
d„¦   «         Zde	fd	„Z
ˆ xZS )ÚModuleWrapperz\A subclass of ``torch.nn.Module`` that wraps a C++ frontend module and delegates all access.r   Nc           	      ój  •— || _         t          ¦   «                              ¦   «          t          |d¦  «        | _        t          |d¦  «        | _        t          |d¦  «        | _        t          |¦  «        D ];}|                     d¦  «        s$t          | |t          | j         |¦  «        ¦  «         Œ<d S )NÚ_parametersÚ_buffersÚ_modulesÚ_)r	   Úsuperr   r   r/   r0   r1   ÚdirÚ
startswithÚsetattrr   )r   r	   r
   Ú	__class__s      €r   r   zModuleWrapper.__init__5   s­   ø€ ð %ˆŒÝ‰Œ×ÒÑÔÐÝ-¨j¸-ÑHÔHˆÔÝ,>¸zÈ:Ñ,VÔ,VˆŒÝ,>¸zÈ:Ñ,VÔ,VˆŒÝ˜
‘O”Oð 	Dð 	DˆDà—?’? 3Ñ'Ô'ð DÝ˜˜d¥G¨D¬O¸TÑ$BÔ$BÑCÔCÐCøð	Dð 	Dr   Tc                 ó  — |                       ¦   «         D ]=} ||j        ¦  «        |_        |j        � ||j        j        ¦  «        |j        _        Œ>|                      ¦   «         D ]} ||j        ¦  «        |_        Œ| S r   )Ú
parametersÚdataÚ_gradÚbuffers)r   ÚfnÚrecurseÚparamÚbufs        r   Ú_applyzModuleWrapper._applyB   s   € Ø—_’_Ñ&Ô&ð 	8ð 	8ˆEð ˜˜EœJ™œˆEŒJØŒ{Ð&Ø#% 2 e¤kÔ&6Ñ#7Ô#7�”Ô øà—<’<‘>”>ð 	$ð 	$ˆCØ�r˜#œ(‘|”|ˆCŒHˆHàˆr   c                 ó   — | j         j        S r   )r	   Útrainingr   s    r   rC   zModuleWrapper.trainingP   s   € ð ŒÔ'Ð'r   c                 ó:   — | j                              |¦  «         d S r   )r	   Útrain)r   Úmodes     r   rC   zModuleWrapper.trainingU   s   € àŒ×Ò˜dÑ#Ô#Ð#Ð#Ð#r   c                 ó4   — | j                              ¦   «         S r   )r	   Ú__repr__r   s    r   rH   zModuleWrapper.__repr__Y   s   € ØŒ×'Ò'Ñ)Ô)Ð)r   r#   )T)r$   r%   r&   r'   r   rA   r(   rC   ÚsetterÚstrrH   Ú__classcell__)r7   s   @r   r-   r-   2   sµ   ø€ € € € € ØfÐfðDð Dð Dð Dð Dð Dðð ð ð ð ð(ð (ñ „Xð(ð „_ð$ð $ð $ñ „_ð$ð*˜#ð *ð *ð *ð *ð *ð *ð *ð *r   r-   N)r'   Útorchr   r   ÚModuler-   r+   r   r   ú<module>rN      s|   ðà 9Ð 9à Ð Ð Ð Ð Ð ð(.ð (.ð (.ð (.ð (.ñ (.ô (.ð (.ðV(*ð (*ð (*ð (*ð (*�B”Iñ (*ô (*ð (*ð (*ð (*r   