
    Ph:%                        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)Conv1dConv2dConv3dReLULinearBatchNorm1dBatchNorm2dBatchNorm3d)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__     nC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\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__   Z    +D1V;@\]a@bfj@j 	y/0LT0R/STpquTvSwx	yj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      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__    r/   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 ReLU modules.
    During quantization this will be replaced with the corresponding fused module.c                     t        |      t        k(  rt        |      t        k(  s)J dj                  t        |      t        |                   t        |   ||       y Nz%Incorrect types for input modules{}{})r   r   r   formatr(   r)   )r+   linearr-   r.   s      r$   r)   zLinearReLU.__init__(   s_    +F3v=B^_cBdhlBl 	Z3::,V46RSW6XZ	Zl 	&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 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__1   Z    +D1V;@\]_@`do@o 	w/0LT0R/STpqsTtSuv	wor"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 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__9   rB   r#   r0   r3   s   @r$   r   r   6   rC   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(  s3J dj	                  t        |      t        |      t        |                   t
        |   |||       y Nz'Incorrect types for input modules{}{}{})r   r   r   r   r<   r(   r)   r+   r,   rA   r-   r.   s       r$   r)   zConvBnReLU1d.__init__A   u    +D1V;@\]_@`do@o(.$6	~8aV068TUW8XZvw{Z|}	~ 7 	r4(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 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(  s3J dj	                  t        |      t        |      t        |                   t
        |   |||       y rH   )r   r   r	   r   r<   r(   r)   rI   s       r$   r)   zConvBnReLU2d.__init__J   rJ   r#   r0   r3   s   @r$   r   r   G   rK   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__S   rB   r#   r0   r3   s   @r$   r   r   P   rC   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(  s3J dj	                  t        |      t        |      t        |                   t
        |   |||       y rH   )r   r   r
   r   r<   r(   r)   rI   s       r$   r)   zConvBnReLU3d.__init__[   rJ   r#   r0   r3   s   @r$   r   r   X   rK   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j                  t        |      t        |                   t        |   ||       y r;   )r   r	   r   r<   r(   r)   r+   
batch_normr-   r.   s      r$   r)   zBNReLU2d.__init__e   _    +J7;FKghlKmquKu 	^3::,Z8:VW[:\^	^u 	T*r#   r0   r3   s   @r$   r   r   b       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j                  t        |      t        |                   t        |   ||       y r;   )r   r
   r   r<   r(   r)   rT   s      r$   r)   zBNReLU3d.__init__n   rV   r#   r0   r3   s   @r$   r   r   k   rW   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=   rA   r.   s      r$   r)   zLinearBn1d.__init__x   sZ    +F3v=B^_aBbfqBq 	y/0LV0T/UVrsuVvUwx	yq$r#   r0   r3   s   @r$   r   r   u   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[    F|v%$z*:ehh>P>P*P 	Q/V~d:>N=OP	QP,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    F|v%$t**E 	K/V~d4j\J	KE&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,   rj   r.   s      r$   r)   zConvAdd2d.__init__   s    r#   c                 8    | j                   | d   |      |      S Nr   )rj   r+   x1x2s      r$   forwardzConvAdd2d.forward   s    xxQR((r#   r   r    r!   r1   r)   rp   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 ri   )r(   r)   rj   r-   )r+   r,   rj   r-   r.   s       r$   r)   zConvAddReLU2d.__init__   s    	r#   c                 V    | j                  | j                   | d   |      |            S rl   )r-   rj   rm   s      r$   rp   zConvAddReLU2d.forward   s&    yy'$q'"+r233r#   rq   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>ry      s     ` ` ` CX
	588&& 	% %% %% %' '#| ##| #)< ))< )#| #)< )+| ++| +% %-l -' ') )	4L 	4r#   