U
    ©Ê¹j%  ã                   @   s$   d dl mZ ejejdœdd„ZdS )é    N)ÚgmÚreturnc              	      s6   dd„ ‰ | j j‡ fdd„d�� |  ¡  W 5 Q R X | 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.
    c                 S   s   d| •S )Núimport pdb; pdb.set_trace()
)r   © ©Úbodyr   r   úZ/var/www/html/bwave/python/venv/lib/python3.8/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>   s    þz-set_trace.<locals>.<lambda>.<locals>.<lambda>r   ©r
   ©r	   r   r   r      s    zset_trace.<locals>.<lambda>)Zmake_transformer)ÚgraphZon_generate_codeZ	recompile)r   r   r   r   Ú	set_trace   s    
ÿr   )Ztorch.fxZfxZGraphModuler   r   r   r   r   Ú<module>   s   