o
    h+                     @   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   o/var/www/html/construction_image-detection-poc/venv/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>)make_transformerN)r   strlistgraphon_generate_code	recompile)r   r   r   r	   r   	   s   


)collections.abcr   torch.fxfx__all__GraphModuler   r   r   r   r	   <module>   s    