o
    !i%                     @   s&   d dl mZ dejdejfddZdS )    Ngmreturnc                    sL   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.
    c                 S   s
   dg| S )Nzimport pdb; pdb.set_trace()
 bodyr   r   j/var/www/html/eduruby.in/lip-sync/lip-sync-env/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)graphZon_generate_codeZ	recompile)r   r   r   r   	set_trace   s   


r   )Ztorch.fxZfxZGraphModuler   r   r   r   r   <module>   s    