o
    Zh+                     @   s8   d dl mZ d dlmZ dgZdejdejfddZdS )    )SequenceN	set_tracegmreturnc                    s^   dt t dtt fdd | jj fddd |   W d   | S 1 s(w   Y  | S )	a  
    Sets a breakpoint in `gm`'s generated python code. It drops into pdb when
    `gm` gets run.

    Args:
        gm: graph module to insert breakpoint. It is then recompiled for it to
            take effect.

    Returns:
        the `gm` with breakpoint inserted.
    bodyr   c                 S   s
   dg| S )Nzimport pdb; pdb.set_trace()
 r   r   r   J/var/www/auris/lib/python3.10/site-packages/torch/fx/experimental/debug.py
insert_pdb   s   
zset_trace.<locals>.insert_pdbc                    s    fddS )Nc                    s    r | S | S )Nr   r   )cur_transformr
   r   r	   <lambda>   s    z-set_trace.<locals>.<lambda>.<locals>.<lambda>r   r   r
   r   r	   r      s   zset_trace.<locals>.<lambda>)Zmake_transformerN)r   strlistgraphZon_generate_codeZ	recompile)r   r   r   r	   r   	   s   


)collections.abcr   Ztorch.fxZfx__all__ZGraphModuler   r   r   r   r	   <module>   s    