U
    ©Ê¹j€  ã                   @   sL  d dl mZmZmZmZ ddlmZ d dlmZm	Z	 ddgZ
dZdd	„ Zd
d„ Zeeddddddddddg
ƒZdd„ e_edd�eƒ eeddddddgƒZdd„ e_edd�eƒ eeef eee ef dœdd„Zee eeeef d œd!d"„Zee eee ef dœd#d$„Zee eee d œd%d&„Ze	eeeƒ e	eeeƒ d'S )(é    )ÚAnyÚDictÚTupleÚListé   )Úcompatibility)ÚContextÚ_register_pytree_nodeÚimmutable_listÚimmutable_dictzÒIf you are attempting to modify the kwargs or args of a torch.fx.Node object,
instead create a new copy of it and assign the copy to the node:
    new_args = ... # copy and mutate args
    node.args = new_args
c                 O   s   t dt| ƒj› dt› �ƒ‚d S )Nú'z$' object does not support mutation. )ÚNotImplementedErrorÚtypeÚ__name__Ú_help_mutation)ÚselfÚargsÚkwargs© r   ú]/var/www/html/bwave/python/venv/lib/python3.8/site-packages/torch/fx/immutable_collections.pyÚ_no_mutation   s    r   c                 C   s.   t d| j | fi ƒ}|D ]}t||tƒ q|S )NZ
immutable_)r   r   Úsetattrr   )ÚbaseZmutable_functionsÚ	containerÚattrr   r   r   Ú_create_immutable_container   s    r   Ú__delitem__Ú__iadd__Ú__imul__Ú__setitem__ÚappendÚclearÚextendÚinsertÚpopÚremovec                 C   s   t tt| ƒƒffS ©N)r
   ÚtupleÚiter©r   r   r   r   Ú<lambda>   ó    r*   T)Zis_backward_compatibleÚpopitemÚupdatec                 C   s   t t|  ¡ ƒffS r&   )r   r(   Úitemsr)   r   r   r   r*       r+   )ÚdÚreturnc                 C   s   t |  ¡ ƒt |  ¡ ƒfS r&   )ÚlistÚvaluesÚkeys©r/   r   r   r   Ú_immutable_dict_flatten&   s    r5   )r2   Úcontextr0   c                 C   s   t tt|| ƒƒƒS r&   )r   ÚdictÚzip©r2   r6   r   r   r   Ú_immutable_dict_unflatten)   s    r:   c                 C   s   | d fS r&   r   r4   r   r   r   Ú_immutable_list_flatten,   s    r;   c                 C   s   t | ƒS r&   )r
   r9   r   r   r   Ú_immutable_list_unflatten/   s    r<   N)Útypingr   r   r   r   Z_compatibilityr   Ztorch.utils._pytreer   r	   Ú__all__r   r   r   r1   r
   Ú
__reduce__r7   r   r5   r:   r;   r<   r   r   r   r   Ú<module>   s4   
    ÿÿ

$ 