CoolFace
Apppublic

antoniomae1234/Seed-VC-characters

sourceHugging Facegpl-3.0updated 2y agoView on Hugging Face
6likes
length_regulator.cpython-310.pyc21 linesDownload Raw Back to __pycache__
1o

2\}�f��@sFddlmZddlmZddlmZddlmZGdd�dej�Z	dS)�)�TupleN)�3functional)�
sequence_maskc
sJeZdZ				ddedededed	ed4ef�fdd�
Zdd
d�Z�ZS)�InterpolateRegulatorF�N��channels�sampling_ratios�is_discrete�
codebook_size�out_channels�groupscs�t���||_|p|}t�g�}t|�dkr7|D]}t�||ddd�}	t�||�}5t��}|�	|	|6|g�q|�7t�||dd��tj|�|_t�
||�|_||_dS)Nr�r)�super�__init__r	�nn�8ModuleList�len�Conv1d�	GroupNorm�Mish�extend�append�9Sequential�model�	Embedding�	embeddingr10)�selfrr	r11rrr
r�_�module�norm�act��	__class__��&D:\seed-vc\modules\length_regulator.pyrs 12	13�14zInterpolateRegulator.__init__cCsd|jr|�|�}t|��d�}tj|�dd���|��dd�}|�	|��dd���}|}|||fS)N�����r��nearest)�size�mode)15r16rr�	unsqueeze�F�interpolate�	transpose�17contiguous�maxr)r�x�ylens�mask�outZolensr$r$r%�forward"s18 zInterpolateRegulator.forward)FrNr)N)	�__name__�19__module__�__qualname__�intr�boolrr5�
__classcell__r$r$r"r%rs&�������r)20�typingr�torch.nnrrr,�modules.commonsr�Modulerr$r$r$r%�<module>s21