
    Vh+                         d dl mZmZ d dlmZmZ d dlmZmZ d dl	m
Z
 ddlmZ  eed      d	ed
ee
gef   defd       Z eed      d	ed
eegef   defd       ZddgZy)    )AnyCallable)_fx_map_aggregate_fx_map_arg)immutable_dictimmutable_list)Node   )substitute_in_graphT)can_constant_fold_throughafnreturnc                 "    t        | fd      S )Nc                 8    t        | t              r |       S | S N)
isinstancer	   )xr   s    J/home/dcms/DCMS/lib/python3.12/site-packages/torch/_dynamo/polyfills/fx.py<lambda>zmap_arg.<locals>.<lambda>   s    z!T/Bbe      map_aggregate)r   r   s    `r   map_argr   
   s    IJJr   c                 j   t        | t              r4fd| D        }t        | d      r t        |       | }|S t        |      }|S t        | t              r%t        | D cg c]  }t        |       c}      }|S t        | t              r:t        | j                         D cg c]  \  }}|t        |      f c}}      }|S t        | t              rKt        t        | j                        t        | j                        t        | j                              }|S  |       }|S c c}w c c}}w )Nc              3   6   K   | ]  }t        |        y wr   r   ).0elemr   s     r   	<genexpr>z map_aggregate.<locals>.<genexpr>   s     4$mD"%4s   _fields)r   tuplehasattrtypelistr   r   dictr   itemsslicestartstopstep)r   r   itresultr   kvs    `     r   r   r      s    !U4!4!(I!6a" M =B"I M 
At	Q GTtR!8 GH M 
At	qwwy Qtq!!]1b%9!: QR M 
Au	!''2&!&&"%!&&"%
 M AM !H Qs   D*#D/
r   r   N)typingr   r   torch._Cr   r   torch.fx.immutable_collectionsr   r   torch.fx.noder	   
decoratorsr   r   r   __all__ r   r   <module>r6      s      3 I  , [DAKs K$- K# K BK &$GS hucz2 s  H, r   