Ë
    ÌÓ^j6  ã                   ó\   — d dl mZ d dlmZ ddlmZ ddgZ G d„ de«      Z G d„ de«      Zy	)
é    )ÚTensor)Ú_sizeé   )ÚModuleÚFlattenÚ	Unflattenc                   ól   ‡ — e Zd ZU dZddgZeed<   eed<   d
dededdfˆ fd„Zdedefd„Z	de
fd	„Zˆ xZS )r   a¯  
    Flattens a contiguous range of dims into a tensor.

    For use with :class:`~nn.Sequential`, see :meth:`torch.flatten` for details.

    Shape:
        - Input: :math:`(*, S_{\text{start}},..., S_{i}, ..., S_{\text{end}}, *)`,'
          where :math:`S_{i}` is the size at dimension :math:`i` and :math:`*` means any
          number of dimensions including none.
        - Output: :math:`(*, \prod_{i=\text{start}}^{\text{end}} S_{i}, *)`.

    Args:
        start_dim: first dim to flatten (default = 1).
        end_dim: last dim to flatten (default = -1).

    Examples::
        >>> input = torch.randn(32, 1, 5, 5)
        >>> # With default parameters
        >>> m = nn.Flatten()
        >>> output = m(input)
        >>> output.size()
        torch.Size([32, 25])
        >>> # With non-default parameters
        >>> m = nn.Flatten(0, 2)
        >>> output = m(input)
        >>> output.size()
        torch.Size([160, 5])
    Ú	start_dimÚend_dimÚreturnNc                 ó>   •— t         ‰| �  «        || _        || _        y ©N)ÚsuperÚ__init__r
   r   )Úselfr
   r   Ú	__class__s      €úc/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/torch/nn/modules/flatten.pyr   zFlatten.__init__.   s   ø€ Ü‰ÑÔØ"ˆŒØˆ�ó    Úinputc                 óN   — |j                  | j                  | j                  «      S ©z(
        Runs the forward pass.
        )Úflattenr
   r   ©r   r   s     r   ÚforwardzFlatten.forward3   s   € ð �}‰}˜TŸ^™^¨T¯\©\Ó:Ð:r   c                 ó:   — d| j                   › d| j                  › �S )úA
        Returns the extra representation of the module.
        z
start_dim=z
, end_dim=)r
   r   ©r   s    r   Ú
extra_reprzFlatten.extra_repr9   s    € ð ˜DŸN™NÐ+¨:°d·l±l°^ÐDÐDr   )r   éÿÿÿÿ)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__constants__ÚintÚ__annotations__r   r   r   Ústrr   Ú__classcell__©r   s   @r   r   r      sY   ø… ñð: ! )Ð,€MØƒNØƒLñ #ð °Cð Àõ ð
;˜Vð ;¨ó ;ðE˜C÷ Er   c                   ór   ‡ — e Zd ZU dZddgZeed<   eed<   dededdfˆ fd„Zdd„Z	de
de
fd	„Zdefd
„Zˆ xZS )r   a•  
    Unflattens a tensor dim expanding it to a desired shape. For use with :class:`~nn.Sequential`.

    * :attr:`dim` specifies the dimension of the input tensor to be unflattened.

    * :attr:`unflattened_size` is the new shape of the unflattened dimension of the tensor and it can be
      a `tuple` of ints or a `list` of ints or `torch.Size` for `Tensor` input.

    Shape:
        - Input: :math:`(*, S_{\text{dim}}, *)`, where :math:`S_{\text{dim}}` is the size at
          dimension :attr:`dim` and :math:`*` means any number of dimensions including none.
        - Output: :math:`(*, U_1, ..., U_n, *)`, where :math:`U` = :attr:`unflattened_size` and
          :math:`\prod_{i=1}^n U_i = S_{\text{dim}}`.

    Args:
        dim (int): Dimension to be unflattened
        unflattened_size (Union[torch.Size, Tuple, List]): New shape of the unflattened dimension

    Examples:
        >>> input = torch.randn(2, 50)
        >>> # With tuple of ints
        >>> m = nn.Sequential(
        >>>     nn.Linear(50, 50),
        >>>     nn.Unflatten(1, (2, 5, 5))
        >>> )
        >>> output = m(input)
        >>> output.size()
        torch.Size([2, 2, 5, 5])
        >>> # With torch.Size
        >>> m = nn.Sequential(
        >>>     nn.Linear(50, 50),
        >>>     nn.Unflatten(1, torch.Size([2, 5, 5]))
        >>> )
        >>> output = m(input)
        >>> output.size()
        torch.Size([2, 2, 5, 5])
    ÚdimÚunflattened_sizer   Nc                 ó`   •— t         ‰| �  «        | j                  |«       || _        || _        y r   )r   r   Ú_require_tuple_intr+   r,   )r   r+   r,   r   s      €r   r   zUnflatten.__init__k   s,   ø€ Ü‰ÑÔØ×ÑÐ 0Ô1ØˆŒØ 0ˆÕr   c                 ó  — t        |t        t        f«      rKt        |«      D ]<  \  }}t        |t        «      rŒt        ddt        |«      j                  › d|› �z   «      ‚ y t        dt        |«      j                  › �«      ‚)Nz(unflattened_size must be tuple of ints, zbut found element of type z at pos z9unflattened_size must be a tuple of ints, but found type )Ú
isinstanceÚtupleÚlistÚ	enumerater%   Ú	TypeErrorÚtyper    )r   r   ÚidxÚelems       r   r.   zUnflatten._require_tuple_intq   sŒ   € Ü�eœe¤T˜]Ô+Ü& uÓ-ò ‘	��TÜ! $¬Õ,Ü#ØBØ6´t¸D³z×7JÑ7JÐ6KÈ8ÐTWÐSXÐYñZóð ðð ÜØGÌÈUË×H\ÑH\ÐG]Ð^ó
ð 	
r   r   c                 óN   — |j                  | j                  | j                  «      S r   )Ú	unflattenr+   r,   r   s     r   r   zUnflatten.forward~   s   € ð �‰˜tŸx™x¨×)>Ñ)>Ó?Ð?r   c                 ó:   — d| j                   › d| j                  › �S )r   zdim=z, unflattened_size=)r+   r,   r   s    r   r   zUnflatten.extra_repr„   s#   € ð �d—h‘h�ZÐ2°4×3HÑ3HÐ2IÐJÐJr   )r   N)r    r!   r"   r#   r$   r%   r&   r   r   r.   r   r   r'   r   r(   r)   s   @r   r   r   @   sd   ø… ñ$ðL Ð.Ð/€MØ	ƒHØÓð1˜Cð 1°5ð 1¸Tõ 1ó
ð@˜Vð @¨ó @ðK˜C÷ Kr   N)	Útorchr   Útorch.typesr   Úmoduler   Ú__all__r   r   © r   r   ú<module>r@      s;   ðõ Ý å ð �kÐ
"€ô1Eˆfô 1EôhHK�õ HKr   