
    Χg                     ~    d dl Z d dlmZmZmZmZmZ dgZdeegef         deeedf                  dee         fdZ	dS )	    N)AnyCallableIterableListTupletrace_dependenciescallableinputs.returnc                     t                      fd}	 t          j        |           |D ]} | |  	 t          j        d           n# t          j        d           w xY wt                    S )a  Trace the execution of a callable in order to determine which modules it uses.

    Args:
        callable: The callable to execute and trace.
        inputs: The input to use during tracing. The modules used by 'callable' when invoked by each set of inputs
            are union-ed to determine all modules used by the callable for the purpooses of packaging.

    Returns: A list of the names of all modules used during callable execution.
    c                 6   |dk    rd S | j         j        }d }|| j        v r| j        |         j        }nL|| j        v r| j        |         j        }n0d| j        v r't          | j        d         |d           }|r|j        nd }|r                    |           d S d S )Ncallself)f_codeco_name	f_globals
__module__f_localsgetattradd)frameeventargnamemodulemethodmodules_useds         d/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/package/analyze/trace_dependencies.pyrecord_used_modulesz/trace_dependencies.<locals>.record_used_modules   s     F??F |# 5?""_T*5FFU^##^D)4FFu~%%U^F3T4@@F*0:V&&dF  	%V$$$$$	% 	%    N)setsys
setprofilelist)r	   r
   r   inpr   s       @r   r   r   	   s     55L% % % % %:
*+++  	 	CHcNNN	
 	tts   A
 
A )
r"   typingr   r   r   r   r   __all__strr    r    r   <module>r*      s    



 7 7 7 7 7 7 7 7 7 7 7 7 7 7  
 7ucz"7,4U38_,E7	#Y7 7 7 7 7 7r    