U
    yh                     @   sh  d dl mZmZmZmZmZ d dlmZmZm	Z	m
Z
mZmZmZmZ ddlmZ ddgZdZdd	 Zd
d ZeedZdd e_dd e_edde eedZdd e_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ded  eeeed!ed  d"S )#    )AnyDictIterableListTuple)_dict_flatten_dict_flatten_with_keys_dict_unflatten_list_flatten_list_flatten_with_keys_list_unflattenContextregister_pytree_node   )compatibility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 d S )N'z$' object does not support mutation. )NotImplementedErrortype__name___help_mutation)selfargskwargs r   P/var/www/html/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removereversesortc                 C   s   t tt| ffS N)r   tupleiterr   r   r   r   <lambda>:       r3   c                 C   s   t t| S r/   )hashr0   r2   r   r   r   r3   ;   r4   T)Zis_backward_compatible)r#   __ior__r&   r(   r+   popitem
setdefaultupdatec                 C   s   t t|  ffS r/   )r   r1   itemsr2   r   r   r   r3   L   r4   c                 C   s   t t|  S r/   )r5   r0   r:   r2   r   r   r   r3   M   r4   )dreturnc                 C   s   t | S r/   )r   r;   r   r   r   _immutable_dict_flattenR   s    r>   )valuescontextr<   c                 C   s   t t| |S r/   )r   r	   r?   r@   r   r   r   _immutable_dict_unflattenV   s    rB   c                 C   s   t | S r/   )r
   r=   r   r   r   _immutable_list_flatten]   s    rC   c                 C   s   t t| |S r/   )r   r   rA   r   r   r   _immutable_list_unflattena   s    rD   z-torch.fx.immutable_collections.immutable_dict)Zserialized_type_nameZflatten_with_keys_fnz-torch.fx.immutable_collections.immutable_listN)typingr   r   r   r   r   Ztorch.utils._pytreer   r   r	   r
   r   r   r   r   Z_compatibilityr   __all__r   r   r"   listr   
__reduce____hash__dictr   r>   rB   rC   rD   r   r   r   r   <module>   sX   (



$
 