ó
    !Eñi¬{  ã                   ó  • S SK Jr  S SKJs  Jr  S SKJr  S SKJ	r	J
r
Jr  SSKJr  SSKJrJrJr  / SQr " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      r  " S% S&\5      r! " S' S(\5      r" " S) S*\5      r# " S+ S,\5      r$ " S- S.\5      r%g)/é    )ÚSequenceN)ÚTensor)Ú	_size_2_tÚ	_size_4_tÚ	_size_6_té   )ÚModule)Ú_ntupleÚ_pairÚ
_quadruple)ÚCircularPad1dÚCircularPad2dÚCircularPad3dÚConstantPad1dÚConstantPad2dÚConstantPad3dÚReflectionPad1dÚReflectionPad2dÚReflectionPad3dÚReplicationPad1dÚReplicationPad2dÚReplicationPad3dÚ	ZeroPad1dÚ	ZeroPad2dÚ	ZeroPad3dc                   óR   • \ rS rSr% S/r\\   \S'   S rS\	S\	4S jr
S\4S jrSrg	)
Ú_CircularPadNdé!   Úpaddingc                 ó   • [         e©N)ÚNotImplementedError©ÚselfÚinputs     ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/nn/modules/padding.pyÚ_check_input_dimÚ_CircularPadNd._check_input_dim%   s   € Ü!Ð!ó    r%   Úreturnc                 óf   • U R                  U5        [        R                  " XR                  S5      $ )NÚcircular)r'   ÚFÚpadr   r#   s     r&   ÚforwardÚ_CircularPadNd.forward(   s%   € Ø×Ñ˜eÔ$Ü�uŠu�UŸL™L¨*Ó5Ð5r)   c                 ó   • U R                    $ r!   ©r   ©r$   s    r&   Ú
extra_reprÚ_CircularPadNd.extra_repr,   ó   € Ø—,‘,�Ð r)   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__constants__r   ÚintÚ__annotations__r'   r   r/   Ústrr4   Ú__static_attributes__r7   r)   r&   r   r   !   s7   ‡ Ø�K€MØ�c‰]Óò"ð6˜Vð 6¨ô 6ð!˜C÷ !r)   r   c                   óX   ^ • \ rS rSr% Sr\\\4   \S'   S\SS4U 4S jjr	S	S jr
SrU =r$ )
r   é0   a§  Pads the input tensor using circular padding of the input boundary.

Tensor values at the beginning of the dimension are used to pad the end,
and values at the end are used to pad the beginning. If negative padding is
applied then the ends of the tensor get removed.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 2-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`)
        Note that padding size should be less than or equal to the corresponding input dimension.

Shape:
    - Input: :math:`(C, W_{in})` or :math:`(N, C, W_{in})`.
    - Output: :math:`(C, W_{out})` or :math:`(N, C, W_{out})`, where

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("not sure why xdoctest is choking on this")
    >>> m = nn.CircularPad1d(2)
    >>> input = torch.arange(8, dtype=torch.float).reshape(1, 2, 4)
    >>> input
    tensor([[[0., 1., 2., 3.],
             [4., 5., 6., 7.]]])
    >>> m(input)
    tensor([[[2., 3., 0., 1., 2., 3., 0., 1.],
             [6., 7., 4., 5., 6., 7., 4., 5.]]])
    >>> # using different paddings for different sides
    >>> m = nn.CircularPad1d((3, 1))
    >>> m(input)
    tensor([[[1., 2., 3., 0., 1., 2., 3., 0.],
             [5., 6., 7., 4., 5., 6., 7., 4.]]])
r   r*   Nc                 óB   >• [         TU ]  5         [        U5      U l        g r!   ©ÚsuperÚ__init__r   r   ©r$   r   Ú	__class__s     €r&   rF   ÚCircularPad1d.__init__Z   ó   ø€ Ü‰ÑÔÜ˜W“~ˆ�r)   c                 ó�   • UR                  5       S:w  a2  UR                  5       S:w  a  [        SUR                  5        S35      eg g )Né   é   zexpected 2D or 3D input (got úD input)©ÚdimÚ
ValueErrorr#   s     r&   r'   ÚCircularPad1d._check_input_dim^   ó@   € Ø�9‰9‹;˜!Ó §	¡	£¨qÓ 0ÜÐ<¸U¿Y¹Y»[¸MÈÐRÓSÐSð !1Ðr)   r2   ©r*   N)r8   r9   r:   r;   Ú__doc__Útupler=   r>   r   rF   r'   r@   Ú__classcell__©rH   s   @r&   r   r   0   s8   ø‡ ñ$ðN �3˜�8‰_Óð& 	ð &¨d÷ &÷Tò Tr)   r   c                   ó\   ^ • \ rS rSr% Sr\\\\\4   \S'   S\SS4U 4S jjr	S	S jr
SrU =r$ )
r   éc   aV  Pads the input tensor using circular padding of the input boundary.

Tensor values at the beginning of the dimension are used to pad the end,
and values at the end are used to pad the beginning. If negative padding is
applied then the ends of the tensor get removed.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 4-`tuple`, uses (:math:`\text{padding\_left}`,
        :math:`\text{padding\_right}`, :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`)
        Note that padding size should be less than or equal to the corresponding input dimension.

Shape:
    - Input: :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`.
    - Output: :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})`, where

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> m = nn.CircularPad2d(2)
    >>> input = torch.arange(9, dtype=torch.float).reshape(1, 1, 3, 3)
    >>> input
    tensor([[[[0., 1., 2.],
              [3., 4., 5.],
              [6., 7., 8.]]]])
    >>> m(input)
    tensor([[[[4., 5., 3., 4., 5., 3., 4.],
              [7., 8., 6., 7., 8., 6., 7.],
              [1., 2., 0., 1., 2., 0., 1.],
              [4., 5., 3., 4., 5., 3., 4.],
              [7., 8., 6., 7., 8., 6., 7.],
              [1., 2., 0., 1., 2., 0., 1.],
              [4., 5., 3., 4., 5., 3., 4.]]]])
    >>> # using different paddings for different sides
    >>> m = nn.CircularPad2d((1, 1, 2, 0))
    >>> m(input)
    tensor([[[[5., 3., 4., 5., 3.],
              [8., 6., 7., 8., 6.],
              [2., 0., 1., 2., 0.],
              [5., 3., 4., 5., 3.],
              [8., 6., 7., 8., 6.]]]])
r   r*   Nc                 óB   >• [         TU ]  5         [        U5      U l        g r!   ©rE   rF   r   r   rG   s     €r&   rF   ÚCircularPad2d.__init__—   ó   ø€ Ü‰ÑÔÜ! 'Ó*ˆ�r)   c                 ó�   • UR                  5       S:w  a2  UR                  5       S:w  a  [        SUR                  5        S35      eg g )NrM   é   zexpected 3D or 4D input (got rN   rO   r#   s     r&   r'   ÚCircularPad2d._check_input_dim›   rS   r)   r2   rT   )r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r'   r@   rW   rX   s   @r&   r   r   c   s>   ø‡ ñ.ðb �3˜˜S #Ð%Ñ&Ó&ð+ 	ð +¨d÷ +÷Tò Tr)   r   c                   ó`   ^ • \ rS rSr% Sr\\\\\\\4   \S'   S\SS4U 4S jjr	S	S jr
SrU =r$ )
r   é    aþ  Pads the input tensor using circular padding of the input boundary.

Tensor values at the beginning of the dimension are used to pad the end,
and values at the end are used to pad the beginning. If negative padding is
applied then the ends of the tensor get removed.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 6-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`,
        :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`,
        :math:`\text{padding\_front}`, :math:`\text{padding\_back}`)
        Note that padding size should be less than or equal to the corresponding input dimension.

Shape:
    - Input: :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`.
    - Output: :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(C, D_{out}, H_{out}, W_{out})`,
      where

      :math:`D_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}`

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = nn.CircularPad3d(3)
    >>> input = torch.randn(16, 3, 8, 320, 480)
    >>> output = m(input)
    >>> # using different paddings for different sides
    >>> m = nn.CircularPad3d((3, 3, 6, 6, 1, 1))
    >>> output = m(input)
r   r*   Nc                 óN   >• [         TU ]  5         [        S5      " U5      U l        g ©Né   ©rE   rF   r
   r   rG   s     €r&   rF   ÚCircularPad3d.__init__Ê   ó   ø€ Ü‰ÑÔÜ˜q”z 'Ó*ˆ�r)   c                 ó�   • UR                  5       S:w  a2  UR                  5       S:w  a  [        SUR                  5        S35      eg g )Nr`   é   zexpected 4D or 5D input (got rN   rO   r#   s     r&   r'   ÚCircularPad3d._check_input_dimÎ   rS   r)   r2   rT   )r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r'   r@   rW   rX   s   @r&   r   r       sB   ø‡ ñ$ðN �3˜˜S # s¨CÐ/Ñ0Ó0ð+ 	ð +¨d÷ +÷Tò Tr)   r   c                   óx   ^ • \ rS rSr% SS/r\\S'   \\   \S'   S\SS4U 4S jjr	S\
S\
4S jrS\4S	 jrS
rU =r$ )Ú_ConstantPadNdéÓ   r   Úvaluer*   Nc                 ó.   >• [         TU ]  5         Xl        g r!   )rE   rF   rp   )r$   rp   rH   s     €r&   rF   Ú_ConstantPadNd.__init__Ø   s   ø€ Ü‰ÑÔØ�
r)   r%   c                 óZ   • [         R                  " XR                  SU R                  5      $ )NÚconstant)r-   r.   r   rp   r#   s     r&   r/   Ú_ConstantPadNd.forwardÜ   s   € Ü�uŠu�UŸL™L¨*°d·j±jÓAÐAr)   c                 ó:   • SU R                    SU R                   3$ )Nzpadding=z, value=)r   rp   r3   s    r&   r4   Ú_ConstantPadNd.extra_reprß   s   € Ø˜$Ÿ,™,˜ x°·
±
¨|Ð<Ð<r)   )rp   )r8   r9   r:   r;   r<   Úfloatr>   r   r=   rF   r   r/   r?   r4   r@   rW   rX   s   @r&   rn   rn   Ó   sV   ø‡ Ø Ð(€MØƒLØ�c‰]Óð˜eð ¨÷ ðB˜Vð B¨ô Bð=˜C÷ =ò =r)   rn   c                   óR   ^ • \ rS rSr% Sr\\\4   \S'   S\S\	SS4U 4S jjr
SrU =r$ )	r   éã   av  Pads the input tensor boundaries with a constant value.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in both boundaries. If a 2-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`)

Shape:
    - Input: :math:`(C, W_{in})` or :math:`(N, C, W_{in})`.
    - Output: :math:`(C, W_{out})` or :math:`(N, C, W_{out})`, where

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = nn.ConstantPad1d(2, 3.5)
    >>> input = torch.randn(1, 2, 4)
    >>> input
    tensor([[[-1.0491, -0.7152, -0.0749,  0.8530],
             [-1.3287,  1.8966,  0.1466, -0.2771]]])
    >>> m(input)
    tensor([[[ 3.5000,  3.5000, -1.0491, -0.7152, -0.0749,  0.8530,  3.5000,
               3.5000],
             [ 3.5000,  3.5000, -1.3287,  1.8966,  0.1466, -0.2771,  3.5000,
               3.5000]]])
    >>> m = nn.ConstantPad1d(2, 3.5)
    >>> input = torch.randn(1, 2, 3)
    >>> input
    tensor([[[ 1.6616,  1.4523, -1.1255],
             [-3.6372,  0.1182, -1.8652]]])
    >>> m(input)
    tensor([[[ 3.5000,  3.5000,  1.6616,  1.4523, -1.1255,  3.5000,  3.5000],
             [ 3.5000,  3.5000, -3.6372,  0.1182, -1.8652,  3.5000,  3.5000]]])
    >>> # using different paddings for different sides
    >>> m = nn.ConstantPad1d((3, 1), 3.5)
    >>> m(input)
    tensor([[[ 3.5000,  3.5000,  3.5000,  1.6616,  1.4523, -1.1255,  3.5000],
             [ 3.5000,  3.5000,  3.5000, -3.6372,  0.1182, -1.8652,  3.5000]]])
r   rp   r*   Nc                 óD   >• [         TU ]  U5        [        U5      U l        g r!   rD   ©r$   r   rp   rH   s      €r&   rF   ÚConstantPad1d.__init__  s   ø€ Ü‰Ñ˜ÔÜ˜W“~ˆ�r)   r2   )r8   r9   r:   r;   rU   rV   r=   r>   r   rx   rF   r@   rW   rX   s   @r&   r   r   ã   s8   ø‡ ñ)ðX �3˜�8‰_Óð& 	ð &°%ð &¸D÷ &õ &r)   r   c                   ó^   ^ • \ rS rSr% SrSS/r\\\\\4   \S'   S\	S\
SS4U 4S jjrSrU =r$ )	r   i  a  Pads the input tensor boundaries with a constant value.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 4-`tuple`, uses (:math:`\text{padding\_left}`,
        :math:`\text{padding\_right}`, :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`)

Shape:
    - Input: :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`.
    - Output: :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})`, where

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = nn.ConstantPad2d(2, 3.5)
    >>> input = torch.randn(1, 2, 2)
    >>> input
    tensor([[[ 1.6585,  0.4320],
             [-0.8701, -0.4649]]])
    >>> m(input)
    tensor([[[ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000,  3.5000],
             [ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000,  3.5000],
             [ 3.5000,  3.5000,  1.6585,  0.4320,  3.5000,  3.5000],
             [ 3.5000,  3.5000, -0.8701, -0.4649,  3.5000,  3.5000],
             [ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000,  3.5000],
             [ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000,  3.5000]]])
    >>> # using different paddings for different sides
    >>> m = nn.ConstantPad2d((3, 0, 2, 1), 3.5)
    >>> m(input)
    tensor([[[ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000],
             [ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000],
             [ 3.5000,  3.5000,  3.5000,  1.6585,  0.4320],
             [ 3.5000,  3.5000,  3.5000, -0.8701, -0.4649],
             [ 3.5000,  3.5000,  3.5000,  3.5000,  3.5000]]])
r   rp   r*   Nc                 óD   >• [         TU ]  U5        [        U5      U l        g r!   r\   r|   s      €r&   rF   ÚConstantPad2d.__init__F  s   ø€ Ü‰Ñ˜ÔÜ! 'Ó*ˆ�r)   r2   )r8   r9   r:   r;   rU   r<   rV   r=   r>   r   rx   rF   r@   rW   rX   s   @r&   r   r     sH   ø‡ ñ(ðT  Ð(€Mà�3˜˜S #Ð%Ñ&Ó&ð+ 	ð +°%ð +¸D÷ +õ +r)   r   c                   óZ   ^ • \ rS rSr% Sr\\\\\\\4   \S'   S\S\	SS4U 4S jjr
SrU =r$ )	r   iK  aœ  Pads the input tensor boundaries with a constant value.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 6-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`,
        :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`,
        :math:`\text{padding\_front}`, :math:`\text{padding\_back}`)

Shape:
    - Input: :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`.
    - Output: :math:`(N, C, D_{out}, H_{out}, W_{out})` or
      :math:`(C, D_{out}, H_{out}, W_{out})`, where

      :math:`D_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}`

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> m = nn.ConstantPad3d(3, 3.5)
    >>> input = torch.randn(16, 3, 10, 20, 30)
    >>> output = m(input)
    >>> # using different paddings for different sides
    >>> m = nn.ConstantPad3d((3, 3, 6, 6, 0, 1), 3.5)
    >>> output = m(input)
r   rp   r*   Nc                 óP   >• [         TU ]  U5        [        S5      " U5      U l        g re   rg   r|   s      €r&   rF   ÚConstantPad3d.__init__o  s    ø€ Ü‰Ñ˜ÔÜ˜q”z 'Ó*ˆ�r)   r2   )r8   r9   r:   r;   rU   rV   r=   r>   r   rx   rF   r@   rW   rX   s   @r&   r   r   K  sB   ø‡ ñðB �3˜˜S # s¨CÐ/Ñ0Ó0ð+ 	ð +°%ð +¸D÷ +õ +r)   r   c                   óL   • \ rS rSr% S/r\\   \S'   S\S\4S jr	S\
4S jrSrg)	Ú_ReflectionPadNdit  r   r%   r*   c                 óD   • [         R                  " XR                  S5      $ )NÚreflect©r-   r.   r   r#   s     r&   r/   Ú_ReflectionPadNd.forwardx  s   € Ü�uŠu�UŸL™L¨)Ó4Ð4r)   c                 ó   • U R                    $ r!   r2   r3   s    r&   r4   Ú_ReflectionPadNd.extra_repr{  r6   r)   r7   N©r8   r9   r:   r;   r<   r   r=   r>   r   r/   r?   r4   r@   r7   r)   r&   r…   r…   t  s2   ‡ Ø�K€MØ�c‰]Óð5˜Vð 5¨ô 5ð!˜C÷ !r)   r…   c                   óN   ^ • \ rS rSr% Sr\\\4   \S'   S\SS4U 4S jjr	Sr
U =r$ )r   i  aØ  Pads the input tensor using the reflection of the input boundary.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 2-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`)
        Note that padding size should be less than the corresponding input dimension.

Shape:
    - Input: :math:`(C, W_{in})` or :math:`(N, C, W_{in})`.
    - Output: :math:`(C, W_{out})` or :math:`(N, C, W_{out})`, where

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> m = nn.ReflectionPad1d(2)
    >>> # xdoctest: +IGNORE_WANT("other tests seem to modify printing styles")
    >>> input = torch.arange(8, dtype=torch.float).reshape(1, 2, 4)
    >>> input
    tensor([[[0., 1., 2., 3.],
             [4., 5., 6., 7.]]])
    >>> m(input)
    tensor([[[2., 1., 0., 1., 2., 3., 2., 1.],
             [6., 5., 4., 5., 6., 7., 6., 5.]]])
    >>> # using different paddings for different sides
    >>> m = nn.ReflectionPad1d((3, 1))
    >>> m(input)
    tensor([[[3., 2., 1., 0., 1., 2., 3., 2.],
             [7., 6., 5., 4., 5., 6., 7., 6.]]])
r   r*   Nc                 óB   >• [         TU ]  5         [        U5      U l        g r!   rD   rG   s     €r&   rF   ÚReflectionPad1d.__init__¥  rJ   r)   r2   ©r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r@   rW   rX   s   @r&   r   r     ó1   ø‡ ñ ðF �3˜�8‰_Óð& 	ð &¨d÷ &õ &r)   r   c                   óR   ^ • \ rS rSr% Sr\\\\\4   \S'   S\SS4U 4S jjr	Sr
U =r$ )r   iª  aÑ  Pads the input tensor using the reflection of the input boundary.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 4-`tuple`, uses (:math:`\text{padding\_left}`,
        :math:`\text{padding\_right}`, :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`)
        Note that padding size should be less than the corresponding input dimension.

Shape:
    - Input: :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`.
    - Output: :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})` where

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("not sure why xdoctest is choking on this")
    >>> m = nn.ReflectionPad2d(2)
    >>> input = torch.arange(9, dtype=torch.float).reshape(1, 1, 3, 3)
    >>> input
    tensor([[[[0., 1., 2.],
              [3., 4., 5.],
              [6., 7., 8.]]]])
    >>> m(input)
    tensor([[[[8., 7., 6., 7., 8., 7., 6.],
              [5., 4., 3., 4., 5., 4., 3.],
              [2., 1., 0., 1., 2., 1., 0.],
              [5., 4., 3., 4., 5., 4., 3.],
              [8., 7., 6., 7., 8., 7., 6.],
              [5., 4., 3., 4., 5., 4., 3.],
              [2., 1., 0., 1., 2., 1., 0.]]]])
    >>> # using different paddings for different sides
    >>> m = nn.ReflectionPad2d((1, 1, 2, 0))
    >>> m(input)
    tensor([[[[7., 6., 7., 8., 7.],
              [4., 3., 4., 5., 4.],
              [1., 0., 1., 2., 1.],
              [4., 3., 4., 5., 4.],
              [7., 6., 7., 8., 7.]]]])
r   r*   Nc                 óB   >• [         TU ]  5         [        U5      U l        g r!   r\   rG   s     €r&   rF   ÚReflectionPad2d.__init__Û  r^   r)   r2   ©r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r@   rW   rX   s   @r&   r   r   ª  ó7   ø‡ ñ+ð\ �3˜˜S #Ð%Ñ&Ó&ð+ 	ð +¨d÷ +õ +r)   r   c                   óV   ^ • \ rS rSr% Sr\\\\\\\4   \S'   S\SS4U 4S jjr	Sr
U =r$ )r   ià  aè  Pads the input tensor using the reflection of the input boundary.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 6-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`,
        :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`,
        :math:`\text{padding\_front}`, :math:`\text{padding\_back}`)
        Note that padding size should be less than the corresponding input dimension.

Shape:
    - Input: :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`.
    - Output: :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(C, D_{out}, H_{out}, W_{out})`,
      where

      :math:`D_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}`

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("not sure why xdoctest is choking on this")
    >>> m = nn.ReflectionPad3d(1)
    >>> input = torch.arange(8, dtype=torch.float).reshape(1, 1, 2, 2, 2)
    >>> m(input)
    tensor([[[[[7., 6., 7., 6.],
               [5., 4., 5., 4.],
               [7., 6., 7., 6.],
               [5., 4., 5., 4.]],
              [[3., 2., 3., 2.],
               [1., 0., 1., 0.],
               [3., 2., 3., 2.],
               [1., 0., 1., 0.]],
              [[7., 6., 7., 6.],
               [5., 4., 5., 4.],
               [7., 6., 7., 6.],
               [5., 4., 5., 4.]],
              [[3., 2., 3., 2.],
               [1., 0., 1., 0.],
               [3., 2., 3., 2.],
               [1., 0., 1., 0.]]]]])
r   r*   Nc                 óN   >• [         TU ]  5         [        S5      " U5      U l        g re   rg   rG   s     €r&   rF   ÚReflectionPad3d.__init__  ri   r)   r2   ©r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r@   rW   rX   s   @r&   r   r   à  s;   ø‡ ñ-ð` �3˜˜S # s¨CÐ/Ñ0Ó0ð+ 	ð +¨d÷ +õ +r)   r   c                   óL   • \ rS rSr% S/r\\   \S'   S\S\4S jr	S\
4S jrSrg)	Ú_ReplicationPadNdi  r   r%   r*   c                 óD   • [         R                  " XR                  S5      $ )NÚ	replicaterˆ   r#   s     r&   r/   Ú_ReplicationPadNd.forward  s   € Ü�uŠu�UŸL™L¨+Ó6Ð6r)   c                 ó   • U R                    $ r!   r2   r3   s    r&   r4   Ú_ReplicationPadNd.extra_repr  r6   r)   r7   NrŒ   r7   r)   r&   rœ   rœ     s2   ‡ Ø�K€MØ�c‰]Óð7˜Vð 7¨ô 7ð!˜C÷ !r)   rœ   c                   óN   ^ • \ rS rSr% Sr\\\4   \S'   S\SS4U 4S jjr	Sr
U =r$ )r   i#  a½  Pads the input tensor using replication of the input boundary.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 2-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`)
        Note that the output dimensions must remain positive.

Shape:
    - Input: :math:`(C, W_{in})` or :math:`(N, C, W_{in})`.
    - Output: :math:`(C, W_{out})` or :math:`(N, C, W_{out})`, where

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("not sure why xdoctest is choking on this")
    >>> m = nn.ReplicationPad1d(2)
    >>> input = torch.arange(8, dtype=torch.float).reshape(1, 2, 4)
    >>> input
    tensor([[[0., 1., 2., 3.],
             [4., 5., 6., 7.]]])
    >>> m(input)
    tensor([[[0., 0., 0., 1., 2., 3., 3., 3.],
             [4., 4., 4., 5., 6., 7., 7., 7.]]])
    >>> # using different paddings for different sides
    >>> m = nn.ReplicationPad1d((3, 1))
    >>> m(input)
    tensor([[[0., 0., 0., 0., 1., 2., 3., 3.],
             [4., 4., 4., 4., 5., 6., 7., 7.]]])
r   r*   Nc                 óB   >• [         TU ]  5         [        U5      U l        g r!   rD   rG   s     €r&   rF   ÚReplicationPad1d.__init__I  rJ   r)   r2   r�   rX   s   @r&   r   r   #  r‘   r)   r   c                   óR   ^ • \ rS rSr% Sr\\\\\4   \S'   S\SS4U 4S jjr	Sr
U =r$ )r   iN  a¢  Pads the input tensor using replication of the input boundary.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 4-`tuple`, uses (:math:`\text{padding\_left}`,
        :math:`\text{padding\_right}`, :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`)
        Note that the output dimensions must remain positive.

Shape:
    - Input: :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`.
    - Output: :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})`, where

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> m = nn.ReplicationPad2d(2)
    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> input = torch.arange(9, dtype=torch.float).reshape(1, 1, 3, 3)
    >>> input
    tensor([[[[0., 1., 2.],
              [3., 4., 5.],
              [6., 7., 8.]]]])
    >>> m(input)
    tensor([[[[0., 0., 0., 1., 2., 2., 2.],
              [0., 0., 0., 1., 2., 2., 2.],
              [0., 0., 0., 1., 2., 2., 2.],
              [3., 3., 3., 4., 5., 5., 5.],
              [6., 6., 6., 7., 8., 8., 8.],
              [6., 6., 6., 7., 8., 8., 8.],
              [6., 6., 6., 7., 8., 8., 8.]]]])
    >>> # using different paddings for different sides
    >>> m = nn.ReplicationPad2d((1, 1, 2, 0))
    >>> m(input)
    tensor([[[[0., 0., 1., 2., 2.],
              [0., 0., 1., 2., 2.],
              [0., 0., 1., 2., 2.],
              [3., 3., 4., 5., 5.],
              [6., 6., 7., 8., 8.]]]])
r   r*   Nc                 óB   >• [         TU ]  5         [        U5      U l        g r!   r\   rG   s     €r&   rF   ÚReplicationPad2d.__init__  r^   r)   r2   r•   rX   s   @r&   r   r   N  r–   r)   r   c                   óV   ^ • \ rS rSr% Sr\\\\\\\4   \S'   S\SS4U 4S jjr	Sr
U =r$ )r   i„  a  Pads the input tensor using replication of the input boundary.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 6-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`,
        :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`,
        :math:`\text{padding\_front}`, :math:`\text{padding\_back}`)
        Note that the output dimensions must remain positive.

Shape:
    - Input: :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`.
    - Output: :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(C, D_{out}, H_{out}, W_{out})`,
      where

      :math:`D_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}`

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = nn.ReplicationPad3d(3)
    >>> input = torch.randn(16, 3, 8, 320, 480)
    >>> output = m(input)
    >>> # using different paddings for different sides
    >>> m = nn.ReplicationPad3d((3, 3, 6, 6, 1, 1))
    >>> output = m(input)
r   r*   Nc                 óN   >• [         TU ]  5         [        S5      " U5      U l        g re   rg   rG   s     €r&   rF   ÚReplicationPad3d.__init__ª  ri   r)   r2   rš   rX   s   @r&   r   r   „  s;   ø‡ ñ ðF �3˜˜S # s¨CÐ/Ñ0Ó0ð+ 	ð +¨d÷ +õ +r)   r   c                   ó\   ^ • \ rS rSr% Sr\\\4   \S'   S\SS4U 4S jjr	S\
4S jrSrU =r$ )	r   i¯  aO  Pads the input tensor boundaries with zero.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in both boundaries. If a 2-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`)

Shape:
    - Input: :math:`(C, W_{in})` or :math:`(N, C, W_{in})`.
    - Output: :math:`(C, W_{out})` or :math:`(N, C, W_{out})`, where

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = nn.ZeroPad1d(2)
    >>> input = torch.randn(1, 2, 4)
    >>> input
    tensor([[[-1.0491, -0.7152, -0.0749,  0.8530],
             [-1.3287,  1.8966,  0.1466, -0.2771]]])
    >>> m(input)
    tensor([[[ 0.0000,  0.0000, -1.0491, -0.7152, -0.0749,  0.8530,  0.0000,
               0.0000],
             [ 0.0000,  0.0000, -1.3287,  1.8966,  0.1466, -0.2771,  0.0000,
               0.0000]]])
    >>> m = nn.ZeroPad1d(2)
    >>> input = torch.randn(1, 2, 3)
    >>> input
    tensor([[[ 1.6616,  1.4523, -1.1255],
             [-3.6372,  0.1182, -1.8652]]])
    >>> m(input)
    tensor([[[ 0.0000,  0.0000,  1.6616,  1.4523, -1.1255,  0.0000,  0.0000],
             [ 0.0000,  0.0000, -3.6372,  0.1182, -1.8652,  0.0000,  0.0000]]])
    >>> # using different paddings for different sides
    >>> m = nn.ZeroPad1d((3, 1))
    >>> m(input)
    tensor([[[ 0.0000,  0.0000,  0.0000,  1.6616,  1.4523, -1.1255,  0.0000],
             [ 0.0000,  0.0000,  0.0000, -3.6372,  0.1182, -1.8652,  0.0000]]])
r   r*   Nc                 ó&   >• [         TU ]  US5        g ©Ng        ©rE   rF   rG   s     €r&   rF   ÚZeroPad1d.__init__Ý  ó   ø€ Ü‰Ñ˜ #Õ&r)   c                 ó   • U R                    $ ©z0
Return the extra representation of the module.
r2   r3   s    r&   r4   ÚZeroPad1d.extra_reprà  ó   € ð —,‘,�Ð r)   r7   )r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r?   r4   r@   rW   rX   s   @r&   r   r   ¯  s=   ø‡ ñ)ðV �3˜�8‰_Óð' 	ð '¨d÷ 'ð!˜C÷ !ò !r)   r   c                   ó`   ^ • \ rS rSr% Sr\\\\\4   \S'   S\SS4U 4S jjr	S\
4S jrSrU =r$ )	r   iç  aÃ  Pads the input tensor boundaries with zero.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 4-`tuple`, uses (:math:`\text{padding\_left}`,
        :math:`\text{padding\_right}`, :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`)

Shape:
    - Input: :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`.
    - Output: :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})`, where

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = nn.ZeroPad2d(2)
    >>> input = torch.randn(1, 1, 3, 3)
    >>> input
    tensor([[[[-0.1678, -0.4418,  1.9466],
              [ 0.9604, -0.4219, -0.5241],
              [-0.9162, -0.5436, -0.6446]]]])
    >>> m(input)
    tensor([[[[ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
              [ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
              [ 0.0000,  0.0000, -0.1678, -0.4418,  1.9466,  0.0000,  0.0000],
              [ 0.0000,  0.0000,  0.9604, -0.4219, -0.5241,  0.0000,  0.0000],
              [ 0.0000,  0.0000, -0.9162, -0.5436, -0.6446,  0.0000,  0.0000],
              [ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
              [ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000]]]])
    >>> # using different paddings for different sides
    >>> m = nn.ZeroPad2d((1, 1, 2, 0))
    >>> m(input)
    tensor([[[[ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
              [ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
              [ 0.0000, -0.1678, -0.4418,  1.9466,  0.0000],
              [ 0.0000,  0.9604, -0.4219, -0.5241,  0.0000],
              [ 0.0000, -0.9162, -0.5436, -0.6446,  0.0000]]]])
r   r*   Nc                 ó&   >• [         TU ]  US5        g r­   r®   rG   s     €r&   rF   ÚZeroPad2d.__init__  r°   r)   c                 ó   • U R                    $ r²   r2   r3   s    r&   r4   ÚZeroPad2d.extra_repr  r´   r)   r7   )r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r?   r4   r@   rW   rX   s   @r&   r   r   ç  sC   ø‡ ñ*ðX �3˜˜S #Ð%Ñ&Ó&ð' 	ð '¨d÷ 'ð!˜C÷ !ò !r)   r   c                   ód   ^ • \ rS rSr% Sr\\\\\\\4   \S'   S\SS4U 4S jjr	S\
4S jrSrU =r$ )	r   i   a~  Pads the input tensor boundaries with zero.

For `N`-dimensional padding, use :func:`torch.nn.functional.pad()`.

Args:
    padding (int, tuple): the size of the padding. If is `int`, uses the same
        padding in all boundaries. If a 6-`tuple`, uses
        (:math:`\text{padding\_left}`, :math:`\text{padding\_right}`,
        :math:`\text{padding\_top}`, :math:`\text{padding\_bottom}`,
        :math:`\text{padding\_front}`, :math:`\text{padding\_back}`)

Shape:
    - Input: :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`.
    - Output: :math:`(N, C, D_{out}, H_{out}, W_{out})` or
      :math:`(C, D_{out}, H_{out}, W_{out})`, where

      :math:`D_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}`

      :math:`H_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}`

      :math:`W_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}`

Examples::

    >>> m = nn.ZeroPad3d(3)
    >>> input = torch.randn(16, 3, 10, 20, 30)
    >>> output = m(input)
    >>> # using different paddings for different sides
    >>> m = nn.ZeroPad3d((3, 3, 6, 6, 0, 1))
    >>> output = m(input)
r   r*   Nc                 ó&   >• [         TU ]  US5        g r­   r®   rG   s     €r&   rF   ÚZeroPad3d.__init__C  r°   r)   c                 ó   • U R                    $ r²   r2   r3   s    r&   r4   ÚZeroPad3d.extra_reprF  r´   r)   r7   )r8   r9   r:   r;   rU   rV   r=   r>   r   rF   r?   r4   r@   rW   rX   s   @r&   r   r      sG   ø‡ ñð@ �3˜˜S # s¨CÐ/Ñ0Ó0ð' 	ð '¨d÷ 'ð!˜C÷ !ò !r)   r   )&Úcollections.abcr   Útorch.nn.functionalÚnnÚ
functionalr-   Útorchr   Útorch.nn.common_typesr   r   r   Úmoduler	   Úutilsr
   r   r   Ú__all__r   r   r   r   rn   r   r   r   r…   r   r   r   rœ   r   r   r   r   r   r   r7   r)   r&   Ú<module>rÈ      s%  ðå $ç Ð Ý ß AÑ Aå ß -Ñ -ò
€ô&!�Vô !ô0T�Nô 0Tôf:T�Nô :Tôz0T�Nô 0Tôf=�Vô =ô 1&�Nô 1&ôh1+�Nô 1+ôh&+�Nô &+ôR!�vô !ô(&Ð&ô (&ôV3+Ð&ô 3+ôl5+Ð&ô 5+ôp!˜ô !ô(&Ð(ô (&ôV3+Ð(ô 3+ôl(+Ð(ô (+ôV5!�ô 5!ôp6!�ô 6!ôr*!�õ *!r)   