a
    h+                     @   s6   d dl mZ d dlmZ dgZejejdddZdS )    )SequenceN	set_trace)gmreturnc                    sZ   t t tt ddd | jj fddd |   W d   n1 sL0    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   I/var/www/auris/lib/python3.9/site-packages/torch/fx/experimental/debug.py
insert_pdb   s    zset_trace.<locals>.insert_pdbc                    s    fddS )Nc                    s    r | n| S )Nr   r   )cur_transformr
   r   r	   <lambda>       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   