
    [Thu                         S SK JrJrJrJr  S SKJrJrJr  S SK	J
r
  S SKJr  S SKJrJr  \" S5      r\" S5      r\" S5      rS	S
S.S\S\\   S\S\\   S\4
S jjrS\\\4   S\\\4   4S jrg
)    )AnyCallableOptionalTypeVar)	ParamSpecTypeVarTupleUnpack)TorchRefsMode)GraphModule)make_fxwrapper_and_args_for_make_fxTPTsatenN)executorexecutor_parametersgmargsr   r   returnc                N    US:X  a  U R                   " U6 $ SU S3n[        U5      e)z>
Prototype ATen executor.

Just executes the context's graph.
r   z*Received unexpected value for 'executor': z. Allowed values are: aten.)forward
ValueError)r   r   r   r   msgs        M/var/www/auris/envauris/lib/python3.13/site-packages/torch/_prims/executor.pyexecuter      s4     6zz4  6xj@[
\C
S/    fnc                 d   ^  S[         R                  S[         R                  S[        4U 4S jjnU$ )av  
Returns a function that, when called, will
trace its torch operations to prims and then
execute those prims on the requested trace executor
(possibly lowering them to that trace executor first).

Only supports the torch operations defined in _torch_to_reference_map
in context.py and operations with positional args. All args must
be tensors.
In the near future all these restrictions will be lifted.

Example usage:

def foo(a, b):
  return torch.add(a, b)

traced_foo = make_traced(foo)

a = torch.randn((1, 2, 3, 4, 5), device='cuda')
b = torch.randn((1, 2, 3, 4, 5), device='cuda')
result = traced_foo(a, b, executor='aten')
r   kwargsr   c                     > [        UR                  SS5      5      n[        TX5      u  p4[        5          [	        U5      " U5      nS S S 5        [        WXBS9$ ! , (       d  f       N= f)Nr   r   )r   )strpopr   r
   r   r   )r   r    r   wrappedall_argsr   r   s         r   _tracedmake_traced.<locals>._traced9   sW    vzz*f56 9TJ_!(+B r877 _s   A
A')r   r   r    r   )r   r&   s   ` r   make_tracedr(   !   s,    08qvv 8 8a 8 Nr   )typingr   r   r   r   typing_extensionsr   r   r	   torch._prims.contextr
   torch.fxr   "torch.fx.experimental.proxy_tensorr   r   r   r   r   r"   dictr   r(    r   r   <module>r0      s    3 3 = = .   T CLcN$ *.	":  "$	
 	&"HQTN "x1~ "r   