o
    i                     @   sn   d dl Z d dlZd dlZd dlmZ dd ZdejdejfddZd	d
 Zdd Z	dd Z
dd Zdd ZdS )    N)tablesc                 K   s   | dddk}tj |d d }t| dr(|| j|| dd| jjd| _nJ t| t| }t	
t||_t	
t||_t	
t||_t	
t||_t	
t||_t	
t||_|S )	NtypeonnxencoderExportctc
input_sizei0  )r   	feats_dim
ctc_linear)getr   encoder_classeshasattrr   r   ctc_loprintcopytypes
MethodTypeexport_encoder_forwardforwardexport_encoder_dummy_inputsexport_dummy_inputsexport_encoder_input_namesexport_input_namesexport_encoder_output_namesexport_output_namesexport_encoder_dynamic_axesexport_dynamic_axesexport_encoder_nameexport_name)modelkwargsis_onnxencoder_classencoder_model r$   V/home/ubuntu/.local/lib/python3.10/site-packages/funasr/models/sanm_kws/export_meta.pyexport_rebuild_model   s$   



r&   speechspeech_lengthsc                 C   s(   ||dd}| j di |\}}||fS )NT)r'   r(   onliner$   )r   )selfr'   r(   batchencoder_outencoder_out_lenr$   r$   r%   r   ,   s   r   c                 C   s*   t ddd}t jddgt jd}||fS )N      i     )dtype)torchrandntensorint32)r*   r'   r(   r$   r$   r%   r   A   s   r   c                 C      ddgS )Nr'   r(   r$   r*   r$   r$   r%   r   G   s   r   c                 C   r6   )Nr,   r-   r$   r7   r$   r$   r%   r   K   s   r   c                 C   s"   dddddidddddidS )N
batch_sizefeats_length)r      r   )r'   r(   r,   r-   r$   r7   r$   r$   r%   r   P   s   r   c                 C   s   dS )Nzencoder.onnxr$   r7   r$   r$   r%   r   a   s   r   )r   r   r2   funasr.registerr   r&   Tensorr   r   r   r   r   r   r$   r$   r$   r%   <module>   s    
