o
    i	                     @   s   d dl mZmZmZ d dlm  mZ d dlm  mZ d dl	m
Z
 d dlmZ d dlmZmZmZ d dlmZ ededed	ee fd
dZededed	ee fddZedeeef ded	ee fddZdS )    )ListOptionalUnionN)kernel_signature)with_native_function_and_index)BackendIndexNativeFunctionNativeFunctionsGroup)mapMaybefbackend_indexreturnc                 C   sV   t | |}|| }|d u rd S d|jv rd S |jrdnd}| d|j|jd dS )Nzlegacy::ZstaticZ	TORCH_API )name;)r   
get_kernelkernelexternaldecl)r   r   sigmetadataprefix r   m/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/torchgen/dest/native_functions.pygen_unstructured   s   


r   gc                 C   sj   t | }t| }|| }|d u rg S |jrdnd}d| d|j d| dddd	 |D  d
	gS )N z
TORCH_API zstruct Zstructured_z : public at::meta::structured_z {
void impl(z, c                 s   s    | ]}|  V  qd S N)r   ).0ar   r   r   	<genexpr>$   s    z!gen_structured.<locals>.<genexpr>z);
};
)metar   
structuredZimpl_argumentsr   r   r   join)r   r   Z	meta_nameZout_argsr   r   r   r   r   gen_structured   s    


r$   c                    sp     | }t| tr*|d ur|jr jrtdt|  S tt fdd| 	 S t
|  }|d u r5g S |gS )Nz>Structured external backend functions are not implemented yet.c                    s
   t |  S r   )r   )r   r   r   r   <lambda><   s   
 z5compute_native_function_declaration.<locals>.<lambda>)r   
isinstancer	   r"   r   AssertionErrorr$   listr
   Z	functionsr   )r   r   r   xr   r%   r   #compute_native_function_declaration,   s   



r+   )typingr   r   r   Ztorchgen.api.metaapir!   Ztorchgen.api.structuredr"   Ztorchgen.api.typesr   Ztorchgen.contextr   Ztorchgen.modelr   r   r	   Ztorchgen.utilsr
   strr   r$   r+   r   r   r   r   <module>   s&    
