CoolFace
Apppublic

Florii/Aesthetic_RVC

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
transforms.cpython-39.pyc49 linesDownload Raw Back to __pycache__
1a

2�\eU�@s|ddlZddlmZddlZdZdZdZdddeeefdd�Z	dd	d3�Z4dddeeefdd
�Zdddddeeefdd�ZdS)�N)�5functionalg����MbP?F��?c6CsL|durt}7i}nt}8||d�}|9f||||||||	d�|��\}}
||
fS)N)�tails�10tail_bound)�inputs�unnormalized_widths�unnormalized_heights�unnormalized_derivatives�inverse�
min_bin_width�min_bin_height�min_derivative)�rational_quadratic_spline�'unconstrained_rational_quadratic_spline)rrrr	r11rrrrr
�	spline_fn�
spline_kwargs�outputs�	logabsdet�r�\C:\Users\marce\Downloads\Applio\Applio-RVC-Fork-Recode-Beautify\lib\infer_pack\transforms.py�&piecewise_rational_quadratic_transforms$12�	�13r�����ư>cCs*|d|7<tj|d|kdd�dS)N�.������.Nr��dim�)�torch�sum)�
bin_locationsr�epsrrr�searchsorted-sr"�linearc14Cs�||k||k@}15|16}t�|�}t�|�}
|dkr�tj|dd�}t�t�d|	�d�}||d<||d<||||<d|
|<ntd�|���t	||17||18dd�f||19dd�f||20dd�f||||||||	d	�\||21<|
|22<||
fS)23Nr#)rr)�padr�.rrrz{} tails are not implemented.)rrrr	r24�left�right�bottom�toprrr
)25r�26zeros_like�Fr$�np�log�exp�RuntimeError�formatr)rrrr	r27rrrrr
�inside_interval_mask�outside_interval_maskrr�constantrrrr2s<282930��r�c'Cs�t�|�|kst�|�|kr$td��|jd}|	|dkrBtd��|31|dkrVtd��tj|dd�}
|	d|	||
}
tj|
dd�}tj|dd	d32d�}||||}||d<||d
<|ddd�f|ddd�f}
|t�	|�}tj|dd�}|33d|34||}tj|dd�}tj|dd	d35d�}||||}||d<||d
<|ddd�f|ddd�f}|�r~t36||�d}nt37||�d}|�d|�d}|
�d|�d}|�d|�d}||
}|�d|�d}|�d|�d}|ddd�f�d|�d}|�d|�d}|�r0||||d||||}||||||d|}|||}|�d�d||}|dk�
��s�J�d||t�|�}|||} |d|}!|||d||!}"|�d�||�d�d||!|d|�d�}#t�|#�dt�|"�}$| |$fS|||}%|%d|%}!|||%�d�||!}&|||d||!}"||&|"} |�d�||%�d�d||!|d|%�d�}#t�|#�dt�|"�}$| |$fSdS)Nz-Input to a transform is not within its domainrrz2Minimal bin width too large for the number of binsz3Minimal bin height too large for the number of binsrr)rrr3r4)r$�mode�valuer%r.r��r)r�min�max�38ValueError�shaper+�softmax�cumsumr$�softplusr"�gather�pow�all�sqrtr-)'rrrr	r39r&r'r(r)rrr
�num_bins�widths�	cumwidths�derivatives�heights�40cumheights�bin_idx�input_cumwidths�input_bin_widths�input_cumheights�delta�input_delta�input_derivatives�input_derivatives_plus_one�
input_heights�a�b�c�discriminant�rootr�theta_one_minus_theta�denominator�derivative_numeratorr�theta�	numeratorrrrrds�41  �42����43���44���45���r)r)
r�torch.nnrr+�numpyr,�DEFAULT_MIN_BIN_WIDTH�DEFAULT_MIN_BIN_HEIGHT�DEFAULT_MIN_DERIVATIVErr"rrrrrr�<module>s:�46!47 48�497�