
    sg&                        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 y))    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y)_FusedModuleN)__name__
__module____qualname__     V/var/www/html/venv/lib/python3.12/site-packages/torch/ao/nn/intrinsic/modules/fused.pyr   r   &   s    r#   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        |   ||       y Nz!Incorrect types for input modules)r   r   r
   super__init__selfconvrelu	__class__s      r$   r)   zConvReLU1d.__init__.   ^    (.&8,T2d:	x //KD/Q.RSoptSuRvw	x; 	t$r#   r   r    r!   __doc__r)   __classcell__r.   s   @r$   r   r   *       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        |   ||       y r'   )r   r   r
   r(   r)   r*   s      r$   r)   zConvReLU2d.__init__:   r/   r#   r0   r3   s   @r$   r   r   6   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        |   ||       y r'   )r   r   r
   r(   r)   r*   s      r$   r)   zConvReLU3d.__init__F   r/   r#   r0   r3   s   @r$   r   r   B   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        |   ||       y r'   )r   r	   r
   r(   r)   )r+   linearr-   r.   s      r$   r)   zLinearReLU.__init__R   s^    (0F:,T2d:	z //KF/S.TUqrvUwTxy	z; 	&r#   r0   r3   s   @r$   r   r   N   s    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        |   ||       y r'   )r   r   r   r(   r)   r+   r,   bnr.   s      r$   r)   zConvBn1d.__init__^   _    (.&8,R0K?	v //KD/Q.RSoprSsRtu	v@ 	r"r#   r0   r3   s   @r$   r   r   Z       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        |   ||       y r'   )r   r   r   r(   r)   r>   s      r$   r)   zConvBn2d.__init__j   r@   r#   r0   r3   s   @r$   r   r   f   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                     t        |      t        k(  r$t        |      t        k(  rt        |      t        k(  s)J dt        |       t        |       t        |              t        |   |||       y r'   )r   r   r   r
   r(   r)   r+   r,   r?   r-   r.   s       r$   r)   zConvBnReLU1d.__init__v       (.&8,R0K?,T2d:	Z //KD/Q.RSoprSsRt  vR  SW  vX  uY  Z		Z; 	r4(r#   r0   r3   s   @r$   r   r   r       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                     t        |      t        k(  r$t        |      t        k(  rt        |      t        k(  s)J dt        |       t        |       t        |              t        |   |||       y 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        |   ||       y 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                     t        |      t        k(  r$t        |      t        k(  rt        |      t        k(  s)J dt        |       t        |       t        |              t        |   |||       y 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        |   ||       y r'   )r   r   r
   r(   r)   r+   
batch_normr-   r.   s      r$   r)   zBNReLU2d.__init__   ^    (4C,T2d:	~ //KJ/W.XYuvzY{X|}	~; 	T*r#   r0   r3   s   @r$   r   r          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        |   ||       y 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        |   ||       y r'   )r   r	   r   r(   r)   )r+   r;   r?   r.   s      r$   r)   zLinearBn1d.__init__   s_    (0F:,R0K?	x //KF/S.TUqrtUuTvw	x@ 	$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
        |   ||       y r'   )typer	   torchnn	LeakyReLUr(   r)   )r+   r;   
leaky_relur.   s      r$   r)   zLinearLeakyReLU.__init__   s[    LF"tJ'7588;M;M'M	P.tF|nT*=M<NO	PM,r#   r0   r3   s   @r$   r   r      s    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
        |   ||       y r'   )r[   r	   r\   r]   Tanhr(   r)   )r+   r;   tanhr.   s      r$   r)   zLinearTanh.__init__   sV    LF"tDzUXX]]'B	J.tF|nT$ZLI	JB&r#   r0   r3   s   @r$   r   r      s    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                 2    t         |   |       || _        y N)r(   r)   add)r+   r,   rg   r.   s      r$   r)   zConvAdd2d.__init__   s    r#   c                 8    | j                   | 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      s    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                 @    t         |   |       || _        || _        y rf   )r(   r)   rg   r-   )r+   r,   rg   r-   r.   s       r$   r)   zConvAddReLU2d.__init__   s    	r#   c                 V    | j                  | j                   | d   |      |            S ri   )r-   rg   rj   s      r$   rm   zConvAddReLU2d.forward   s&    yy'$q'"+r233r#   rn   r3   s   @r$   r   r      s    V
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,	588&& 		% 	%	% 	%	% 	%	' 	'	#| 	#	#| 	#
)< 
)
)< 
)	#| 	#
)< 
)	+| 	+	+| 	+	% 	%-l -' '	) 	)
4L 
4r#   