o
    H&i?	                     @   sX  d dl mZ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g dZdd e_dd e_edde eeg dZdd e_dd e_edde deeef deee e	f fddZdee de	deeef fddZdee deee e	f fddZdee de	dee fdd Ze
eee e
eee d!S )"    )AnyDictIterableListTuple   )compatibility)Contextregister_pytree_nodeimmutable_listimmutable_dictzIf 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 )N'z$' object does not support mutation. )NotImplementedErrortype__name___help_mutation)selfargskwargs r   IC:\wamp64\www\opt\env\Lib\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+   c                 C   s   t t| S r'   )hashr(   r*   r   r   r   r+      s    T)Zis_backward_compatible)r   r    r"   r%   popitemupdatec                 C   s   t t|  ffS r'   )r   r)   itemsr*   r   r   r   r+   !   r,   c                 C   s   t t|  S r'   )r-   r(   r0   r*   r   r   r   r+   "   s    dreturnc                 C   s   t |  t |  fS r'   )listvalueskeysr1   r   r   r   _immutable_dict_flatten(   s   r7   r4   contextc                 C   s   t tt|| S r'   )r   dictzipr4   r8   r   r   r   _immutable_dict_unflatten+   s   r<   c                 C   s   | d fS r'   r   r6   r   r   r   _immutable_list_flatten.      r=   c                 C   s   t | S r'   )r   r;   r   r   r   _immutable_list_unflatten1   r>   r?   N)typingr   r   r   r   r   Z_compatibilityr   Ztorch.utils._pytreer	   r
   __all__r   r   r   r3   r   
__reduce____hash__r9   r   r7   r<   r=   r?   r   r   r   r   <module>   s.    



&""