
    %VjiM(                     V   d dl Z d dlmZmZmZmZmZmZmZm	Z	 d dl
mZ g dZ G d de j        j                  Z G d de          Z G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z G d% d&e          Z G d' d(e          Z dS ))    N)BatchNorm1dBatchNorm2dBatchNorm3dConv1dConv2dConv3dLinearReLU)type_before_parametrizations)
ConvReLU1d
ConvReLU2d
ConvReLU3d
LinearReLUConvBn1dConvBn2dConvBnReLU1dConvBnReLU2dConvBn3dConvBnReLU3dBNReLU2dBNReLU3d
LinearBn1dLinearLeakyReLU
LinearTanh	ConvAdd2dConvAddReLU2dc                       e Zd ZdS )_FusedModuleN)__name__
__module____qualname__     ]/root/voice-cloning/.venv/lib/python3.11/site-packages/torch/ao/nn/intrinsic/modules/fused.pyr   r   &   s        Dr#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv1d and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S Nz!Incorrect types for input modules)r   r   r
   super__init__selfconvrelu	__class__s      r$   r)   zConvReLU1d.__init__.       (..&88,T22d:::40LT0R0R 4+D114 4 ;:; 	t$$$$$r#   r   r    r!   __doc__r)   __classcell__r.   s   @r$   r   r   *   D        V V% % % % % % % % %r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv2d and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r
   r(   r)   r*   s      r$   r)   zConvReLU2d.__init__=   r/   r#   r0   r3   s   @r$   r   r   9   r4   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv3d and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r
   r(   r)   r*   s      r$   r)   zConvReLU3d.__init__L   r/   r#   r0   r3   s   @r$   r   r   H   r4   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Linear and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r	   r
   r(   r)   )r+   linearr-   r.   s      r$   r)   zLinearReLU.__init__[   s    (00F::,T22d:::40LV0T0T 4+D114 4 ;:; 	&&&&&r#   r0   r3   s   @r$   r   r   W   sD        V V' ' ' ' ' ' ' ' 'r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv 1d and Batch Norm 1d modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r   r(   r)   r+   r,   bnr.   s      r$   r)   zConvBn1d.__init__j       (..&88,R00K???20LT0R0R 2+B//2 2 @?@ 	r"""""r#   r0   r3   s   @r$   r   r   f   D        V V# # # # # # # # #r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv 2d and Batch Norm 2d modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r   r(   r)   r>   s      r$   r)   zConvBn2d.__init__y   r@   r#   r0   r3   s   @r$   r   r   u   rA   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv 1d, Batch Norm 1d, and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                 N   t          |          t          k    r0t          |          t          k    rt          |          t          k    s8J dt          |           t          |           t          |                       t	                                          |||           d S r'   )r   r   r   r
   r(   r)   r+   r,   r?   r-   r.   s       r$   r)   zConvBnReLU1d.__init__       (..&88,R00K??,T22d:::40LT0R0R 4+B//4+D114 4 ;:; 	r4(((((r#   r0   r3   s   @r$   r   r      D        V V
) 
) 
) 
) 
) 
) 
) 
) 
)r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv 2d, Batch Norm 2d, and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                 N   t          |          t          k    r0t          |          t          k    rt          |          t          k    s8J dt          |           t          |           t          |                       t	                                          |||           d S r'   )r   r   r   r
   r(   r)   rF   s       r$   r)   zConvBnReLU2d.__init__   rG   r#   r0   r3   s   @r$   r   r      rH   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv 3d and Batch Norm 3d modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r   r(   r)   r>   s      r$   r)   zConvBn3d.__init__   r@   r#   r0   r3   s   @r$   r   r      rA   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Conv 3d, Batch Norm 3d, and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                 N   t          |          t          k    r0t          |          t          k    rt          |          t          k    s8J dt          |           t          |           t          |                       t	                                          |||           d S r'   )r   r   r   r
   r(   r)   rF   s       r$   r)   zConvBnReLU3d.__init__   rG   r#   r0   r3   s   @r$   r   r      rH   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the BatchNorm 2d and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r
   r(   r)   r+   
batch_normr-   r.   s      r$   r)   zBNReLU2d.__init__       (44CC,T22d:::40LZ0X0X 4+D114 4 ;:; 	T*****r#   r0   r3   s   @r$   r   r      D        V V+ + + + + + + + +r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the BatchNorm 3d and ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r   r
   r(   r)   rQ   s      r$   r)   zBNReLU3d.__init__   rS   r#   r0   r3   s   @r$   r   r      rT   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Linear and BatchNorm1d modules.
    During quantization this will be replaced with the corresponding fused module.c                     t          |          t          k    rt          |          t          k    s)J dt          |           t          |                       t                                          ||           d S r'   )r   r	   r   r(   r)   )r+   r;   r?   r.   s      r$   r)   zLinearBn1d.__init__   s    (00F::,R00K???20LV0T0T 2+B//2 2 @?@ 	$$$$$r#   r0   r3   s   @r$   r   r      r4   r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Linear and LeakyReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                    t          |          t          k    r"t          |          t          j        j        k    s)J dt          |           t          |                       t                                          ||           d S r'   )typer	   torchnn	LeakyReLUr(   r)   )r+   r;   
leaky_relur.   s      r$   r)   zLinearLeakyReLU.__init__   sz    F||v%%$z*:*:eh>P*P*P*PPVPd:>N>NPP +Q*PP 	,,,,,r#   r0   r3   s   @r$   r   r      sD        V V- - - - - - - - -r#   r   c                   "     e Zd ZdZ fdZ xZS )r   zThis is a sequential container which calls the Linear and Tanh modules.
    During quantization this will be replaced with the corresponding fused module.c                    t          |          t          k    r"t          |          t          j        j        k    s)J dt          |           t          |                       t                                          ||           d S r'   )r[   r	   r\   r]   Tanhr(   r)   )r+   r;   tanhr.   s      r$   r)   zLinearTanh.__init__  su    F||v%%$t***E*E*EJVJd4jjJJ +F*EE 	&&&&&r#   r0   r3   s   @r$   r   r      sD        V V' ' ' ' ' ' ' ' 'r#   r   c                   (     e Zd ZdZ fdZd Z xZS )r   zThis is a sequential container which calls the Conv2d modules with extra Add.
    During quantization this will be replaced with the corresponding fused module.c                 X    t                                          |           || _        d S N)r(   r)   add)r+   r,   rg   r.   s      r$   r)   zConvAdd2d.__init__  s&    r#   c                 L    |                       | d         |          |          S Nr   )rg   r+   x1x2s      r$   forwardzConvAdd2d.forward  s"    xxQR(((r#   r   r    r!   r1   r)   rm   r2   r3   s   @r$   r   r   	  sS        V V    ) ) ) ) ) ) )r#   r   c                   (     e Zd ZdZ fdZd Z xZS )r   zThis is a sequential container which calls the Conv2d, add, Relu.
    During quantization this will be replaced with the corresponding fused module.c                 f    t                                          |           || _        || _        d S rf   )r(   r)   rg   r-   )r+   r,   rg   r-   r.   s       r$   r)   zConvAddReLU2d.__init__  s-    			r#   c                 r    |                      |                      | d         |          |                    S ri   )r-   rg   rj   s      r$   rm   zConvAddReLU2d.forward  s.    yy'$q'"++r22333r#   rn   r3   s   @r$   r   r     sS        V V    
4 4 4 4 4 4 4r#   r   )!r\   torch.nnr   r   r   r   r   r   r	   r
   torch.nn.utils.parametrizer   __all__r]   
Sequentialr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r"   r#   r$   <module>rv      s   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 D C C C C C  ,	 	 	 	 	58& 	 	 	% % % % % % % %% % % % % % % %% % % % % % % %' ' ' ' ' ' ' '# # # # #| # # ## # # # #| # # #) ) ) ) )< ) ) )") ) ) ) )< ) ) )"# # # # #| # # #) ) ) ) )< ) ) )"+ + + + +| + + ++ + + + +| + + +% % % % % % % %- - - - -l - - -' ' ' ' ' ' ' '	) 	) 	) 	) 	) 	) 	) 	)
4 
4 
4 
4 
4L 
4 
4 
4 
4 
4r#   