
    pi                        d dl Z d dlmZmZ d dlZd dlmZ d dlmZ ddlm	Z	 ddl
mZmZmZ  e j                  e      Zed	ej"                  d
eej&                     defd       Zd	ej"                  d
eej&                     dedef   fdZ	 dd	ej"                  d
eej&                     dededef   fdZ e	e      Z ede       y)    N)AnyCallable)make_boxed_func)fx   )aot_autograd   )
CompiledFnregister_backendregister_experimental_backendmodelfake_tensor_inputsreturnc                     t        | |d      S )NFboxedxla_backend_helperr   r   s     a/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/torch/_dynamo/backends/torchxla.pyopenxla_evalr      s     e%7uEE    .c                     t        | |d      S )NTr   r   r   s     r   openxla_eval_boxedr      s     e%7tDDr   r   c                      	 dd l mc m d dt        j
                  dt        f fd}|rt        |      S |S # t        $ r}t        d      |d }~ww xY w)Nr   z_Please follow the instruction in https://github.com/pytorch/xla#pytorchxla to install torch_xlaargsr   c                  8    j                  |        |  S )N)extract_compiled_graph)r   bridgecompiled_graphr   s    r   fwdzxla_backend_helper.<locals>.fwd(   s+     !#::5$GNt$$r   )torch_xla.core.dynamo_bridgecoredynamo_bridgeImportErrortorchTensorr   r   )r   r   r   er!   r   r    s   `    @@r   r   r      se    55 N%5<< %C % $)?31c1  m
	s   	= 	AAA)fw_compileropenxla)namecompiler_fn)F)loggingtypingr   r   r&   functorch.compiler   r   backends.commonr   registryr
   r   r   	getLogger__name__logGraphModulelistr'   r   r   boolr   r*    r   r   <module>r9      s       -  * Q Q g! F>>F/3ELL/AFF FE>>E/3ELL/AEc3hE RW2>>2/3ELL/A2JN2c3h2. " iW 5r   