§
    :zni_O  ã                   ó’  — d dl Z d dlZd dlmZ d dlZd dlmZ d„ Zd„ Zd.d„Z	d„ Z
d„ Zd.d	„Zd/dedededefd„Zd/dedededefd„Z	 	 	 	 	 d0dedededededeej                 defd„Zdededefd„Zdedefd„Zdedefd„Zd„ Zd1d„Zd„ Zd2ded edefd!„Zd2ded edefd"„Zd#„ Z	 d3deded&ed'efd(„Z	 d3deded&ed'efd)„Zd1d*„Zd4d,„Zd-„ Z  e e¦  «        Z! e e¦  «        Z" e e¦  «        Z# e e¦  «        Z$ e e¦  «        Z% e e¦  «        Z& e e¦  «        Z' e e¦  «        Z( e e¦  «        Z) e e¦  «        Z* e e¦  «        Z+dS )5é    N)ÚTensor)ÚOptionalc                 óˆ   — t          j        ¦   «         5  |                      ||¦  «        cd d d ¦  «         S # 1 swxY w Y   d S ©N)ÚtorchÚno_gradÚuniform_©ÚtensorÚaÚbs      úm/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/torch/nn/init.pyÚ_no_grad_uniform_r      sƒ   € Ý	Œ‰Œð %ð %Ø�Š˜q !Ñ$Ô$ð%ð %ð %ð %ñ %ô %ð %ð %ð %ð %ð %ð %øøøð %ð %ð %ð %ð %ð %ó   ”7·;¾;c                 óˆ   — t          j        ¦   «         5  |                      ||¦  «        cd d d ¦  «         S # 1 swxY w Y   d S r   )r   r   Únormal_©r   ÚmeanÚstds      r   Ú_no_grad_normal_r      sƒ   € Ý	Œ‰Œð )ð )Ø�~Š~˜d CÑ(Ô(ð)ð )ð )ð )ñ )ô )ð )ð )ð )ð )ð )ð )øøøð )ð )ð )ð )ð )ð )r   c                 ó"  — d„ }||d|z  z
  k     s||d|z  z   k    rt          j        dd¬¦  «         t          j        ¦   «         5   |||z
  |z  ¦  «        } |||z
  |z  ¦  «        }|                      d|z  dz
  d|z  dz
  |¬¦  «         |                      ¦   «          |                      |t          j        d¦  «        z  ¦  «         |  	                    |¦  «         |  
                    ||¬¦  «         | cd d d ¦  «         S # 1 swxY w Y   d S )	Nc                 ó`   — dt          j        | t          j        d¦  «        z  ¦  «        z   dz  S )Nç      ð?ç       @)ÚmathÚerfÚsqrt)Úxs    r   Únorm_cdfz(_no_grad_trunc_normal_.<locals>.norm_cdf   s)   € à•T”X˜a¥$¤)¨B¡-¤-Ñ/Ñ0Ô0Ñ0°BÑ6Ð6ó    é   zjmean is more than 2 std from [a, b] in nn.init.trunc_normal_. The distribution of values may be incorrect.©Ú
stacklevelé   ©Ú	generatorr   )ÚminÚmax)ÚwarningsÚwarnr   r   r	   Úerfinv_Úmul_r   r   Úadd_Úclamp_)	r   r   r   r   r   r&   r   ÚlÚus	            r   Ú_no_grad_trunc_normal_r1      sˆ  € ð7ð 7ð 7ð 	ˆq�1�s‘7‰{ÒÐ  q¨1¨s©7¡{Ò 2Ð 2ÝŒð Eà!"ð	$ñ 	$ô 	$ð 	$õ 
Œ‰Œð ð ð ˆH�a˜$‘h #Ñ%Ñ&Ô&ˆØˆH�a˜$‘h #Ñ%Ñ&Ô&ˆð 	�Š˜˜A™ ™	 1 q¡5¨1¡9¸	ˆÑBÔBÐBð 	�ŠÑÔÐð 	�Š�C�$œ) B™-œ-Ñ'Ñ(Ô(Ð(Ø�Š�DÑÔÐð 	�Š˜! ˆÑ#Ô#Ð#Øð+ð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð ð s   ÁB2DÄDÄDc                 ó†   — t          j        ¦   «         5  |                      |¦  «        cd d d ¦  «         S # 1 swxY w Y   d S r   )r   r   Úfill_©r   Úvals     r   Ú_no_grad_fill_r6   9   s�   € Ý	Œ‰Œð !ð !Ø�|Š|˜CÑ Ô ð!ð !ð !ð !ñ !ô !ð !ð !ð !ð !ð !ð !øøøð !ð !ð !ð !ð !ð !s   ”6¶:½:c                 ó„   — t          j        ¦   «         5  |                      ¦   «         cd d d ¦  «         S # 1 swxY w Y   d S r   )r   r   Úzero_©r   s    r   Ú_no_grad_zero_r:   >   s}   € Ý	Œ‰Œð ð Ø�|Š|‰~Œ~ðð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð ð s   ”5µ9¼9c                 ó”  — g d¢}| |v s| dk    rdS | dk    rdS | dk    rt          j        d¦  «        S | dk    rw|€d
}nUt          |t          ¦  «        st          |t          ¦  «        st          |t
          ¦  «        r|}nt          d|› d�¦  «        ‚t          j        dd|dz  z   z  ¦  «        S | dk    rdS t          d| › �¦  «        ‚)aÝ  Return the recommended gain value for the given nonlinearity function.
    The values are as follows:

    ================= ====================================================
    nonlinearity      gain
    ================= ====================================================
    Linear / Identity :math:`1`
    Conv{1,2,3}D      :math:`1`
    Sigmoid           :math:`1`
    Tanh              :math:`\frac{5}{3}`
    ReLU              :math:`\sqrt{2}`
    Leaky Relu        :math:`\sqrt{\frac{2}{1 + \text{negative\_slope}^2}}`
    SELU              :math:`\frac{3}{4}`
    ================= ====================================================

    .. warning::
        In order to implement `Self-Normalizing Neural Networks`_ ,
        you should use ``nonlinearity='linear'`` instead of ``nonlinearity='selu'``.
        This gives the initial weights a variance of ``1 / N``,
        which is necessary to induce a stable fixed point in the forward pass.
        In contrast, the default gain for ``SELU`` sacrifices the normalization
        effect for more stable gradient flow in rectangular layers.

    Args:
        nonlinearity: the non-linear function (`nn.functional` name)
        param: optional parameter for the non-linear function

    Examples:
        >>> gain = nn.init.calculate_gain('leaky_relu', 0.2)  # leaky_relu with negative_slope=0.2

    .. _Self-Normalizing Neural Networks: https://papers.nips.cc/paper/2017/hash/5d44ee6f2c3f71b73125876103c8f6c4-Abstract.html
    )ÚlinearÚconv1dÚconv2dÚconv3dÚconv_transpose1dÚconv_transpose2dÚconv_transpose3dÚsigmoidr$   Útanhg«ªªªªªú?Úrelur   Ú
leaky_reluNç{®Gáz„?znegative_slope z not a valid numberr!   Úselug      è?zUnsupported nonlinearity )r   r   Ú
isinstanceÚboolÚintÚfloatÚ
ValueError)ÚnonlinearityÚparamÚ
linear_fnsÚnegative_slopes       r   Úcalculate_gainrR   C   s  € ðB vÐuÐu€JØ�zÐ!Ð! \°YÒ%>Ð%>ØˆqØ	˜Ò	Ð	ØˆwØ	˜Ò	Ð	ÝŒy˜‰~Œ~ÐØ	˜Ò	%Ð	%Øˆ=Ø!ˆNˆNÝ˜E¥4Ñ(Ô(ð 	K­Z¸½sÑ-CÔ-Cð 	KÅzÐRWÕY^ÑG_ÔG_ð 	Kà"ˆNˆNåÐI¨uÐIÐIÐIÑJÔJÐJÝŒy˜  N°aÑ$7Ñ 7Ñ8Ñ9Ô9Ð9Ø	˜Ò	Ð	ØˆwåÐC°\ÐCÐCÑDÔDÐDr    ç        r   r   r   r   Úreturnc                 ó¶   — t           j                             | ¦  «        r*t           j                             t          | f| ||¬¦  «        S t          | ||¦  «        S )ad  Fills the input Tensor with values drawn from the uniform
    distribution :math:`\mathcal{U}(a, b)`.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        a: the lower bound of the uniform distribution
        b: the upper bound of the uniform distribution

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.uniform_(w)
    r
   )r   Ú	overridesÚhas_torch_function_variadicÚhandle_torch_functionr	   r   r
   s      r   r	   r	   z   sU   € õ „×2Ò2°6Ñ:Ô:ð cÝŒ×4Ò4µXÀ¸yÐQWÐ[\Ð`aÐ4ÑbÔbÐbÝ˜V Q¨Ñ*Ô*Ð*r    r   r   c                 ó¶   — t           j                             | ¦  «        r*t           j                             t          | f| ||¬¦  «        S t          | ||¦  «        S )az  Fills the input Tensor with values drawn from the normal
    distribution :math:`\mathcal{N}(\text{mean}, \text{std}^2)`.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        mean: the mean of the normal distribution
        std: the standard deviation of the normal distribution

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.normal_(w)
    r   )r   rV   rW   rX   r   r   r   s      r   r   r   Œ   sU   € õ „×2Ò2°6Ñ:Ô:ð lÝŒ×4Ò4µW¸v¸iÐPVÐ]aÐgjÐ4ÑkÔkÐkÝ˜F D¨#Ñ.Ô.Ð.r    ç       Àr   r&   c                 ó,   — t          | |||||¬¦  «        S )aÏ  Fills the input Tensor with values drawn from a truncated
    normal distribution. The values are effectively drawn from the
    normal distribution :math:`\mathcal{N}(\text{mean}, \text{std}^2)`
    with values outside :math:`[a, b]` redrawn until they are within
    the bounds. The method used for generating the random values works
    best when :math:`a \leq \text{mean} \leq b`.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        mean: the mean of the normal distribution
        std: the standard deviation of the normal distribution
        a: the minimum cutoff value
        b: the maximum cutoff value

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.trunc_normal_(w)
    r%   )r1   )r   r   r   r   r   r&   s         r   Útrunc_normal_r\   �   s   € õ4 " &¨$°°Q¸ÀYÐOÑOÔOÐOr    r5   c                 ó²   — t           j                             | ¦  «        r)t           j                             t          | f| |¬¦  «        S t          | |¦  «        S )zÿFills the input Tensor with the value :math:`\text{val}`.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        val: the value to fill the tensor with

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.constant_(w, 0.3)
    r4   )r   rV   rW   rX   Ú	constant_r6   r4   s     r   r^   r^   º   sP   € õ „×2Ò2°6Ñ:Ô:ð cÝŒ×4Ò4µYÀÀ	ÐRXÐ^aÐ4ÑbÔbÐbÝ˜& #Ñ&Ô&Ð&r    c                 ó"   — t          | d¦  «        S )z¿Fills the input Tensor with the scalar value `1`.

    Args:
        tensor: an n-dimensional `torch.Tensor`

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.ones_(w)
    r   )r6   r9   s    r   Úones_r`   Ê   s   € õ ˜& "Ñ%Ô%Ð%r    c                 ó    — t          | ¦  «        S )zÀFills the input Tensor with the scalar value `0`.

    Args:
        tensor: an n-dimensional `torch.Tensor`

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.zeros_(w)
    )r:   r9   s    r   Úzeros_rb   ×   s   € õ ˜&Ñ!Ô!Ð!r    c                 óâ   — |                       ¦   «         dk    rt          d¦  «        ‚t          j        ¦   «         5  t          j        | j        | | j        dœŽ ddd¦  «         n# 1 swxY w Y   | S )a=  Fills the 2-dimensional input `Tensor` with the identity
    matrix. Preserves the identity of the inputs in `Linear` layers, where as
    many inputs are preserved as possible.

    Args:
        tensor: a 2-dimensional `torch.Tensor`

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.eye_(w)
    r!   ú,Only tensors with 2 dimensions are supported)ÚoutÚrequires_gradN)Ú
ndimensionrM   r   r   ÚeyeÚshaperf   r9   s    r   Úeye_rj   ä   s½   € ð ×ÒÑÔ˜aÒÐÝÐGÑHÔHÐHå	Œ‰Œð Qð QÝŒ	�6”< V¸6Ô;OÐPÐPÐPÐPðQð Qð Qñ Qô Qð Qð Qð Qð Qð Qð Qøøøð Qð Qð Qð Qà€Ms   »A$Á$A(Á+A(r$   c                 ó@  — |                       ¦   «         }|dvrt          d¦  «        ‚|                      ¦   «         }|d         |z  dk    rt          d¦  «        ‚|d         |z  }t          ||d         ¦  «        }t	          j        ¦   «         5  |                      ¦   «          t          |¦  «        D ]Ó}t          |¦  «        D ]Á}|dk    r%d| ||z  |z   ||                      d¦  «        dz  f<   Œ-|dk    r<d| ||z  |z   ||                      d¦  «        dz  |                      d¦  «        dz  f<   Œod| ||z  |z   ||                      d¦  «        dz  |                      d¦  «        dz  |                      d¦  «        dz  f<   ŒÂŒÔ	 d	d	d	¦  «         n# 1 swxY w Y   | S )
aF  Fills the {3, 4, 5}-dimensional input `Tensor` with the Dirac
    delta function. Preserves the identity of the inputs in `Convolutional`
    layers, where as many input channels are preserved as possible. In case
    of groups>1, each group of channels preserves identity

    Args:
        tensor: a {3, 4, 5}-dimensional `torch.Tensor`
        groups (int, optional): number of groups in the conv layer (default: 1)
    Examples:
        >>> w = torch.empty(3, 16, 5, 5)
        >>> nn.init.dirac_(w)
        >>> w = torch.empty(3, 24, 5, 5)
        >>> nn.init.dirac_(w, 3)
    )é   é   é   z5Only tensors with 3, 4, or 5 dimensions are supportedr   z!dim 0 must be divisible by groupsr$   rl   r!   rm   N)rg   rM   Úsizer'   r   r   r8   Úrange)r   ÚgroupsÚ
dimensionsÚsizesÚout_chans_per_grpÚmin_dimÚgÚds           r   Údirac_rx   ø   s,  € ð ×"Ò"Ñ$Ô$€JØ˜Ð"Ð"ÝÐPÑQÔQÐQà�KŠK‰MŒM€EàˆQ„x�&Ñ˜AÒÐÝÐ<Ñ=Ô=Ð=à˜aœ FÑ*ÐÝÐ# U¨1¤XÑ.Ô.€Gå	Œ‰Œð Ið IØ�Š‰Œˆå�v‘”ð 		Ið 		IˆAÝ˜7‘^”^ð Ið I�Ø ’?�?ØPQ�F˜1Ð0Ñ0°1Ñ4°a¸¿ºÀQ¹¼È1Ñ9LÐLÑMÐMØ 1’_�_à23ð ˜1Ð0Ñ0°1Ñ4°a¸¿ºÀQ¹¼È1Ñ9LØ!Ÿ;š; q™>œ>¨QÑ.ð/ñ 0ð 0ð HIð ˜1Ð0Ñ0°1Ñ4°a¸¿ºÀQ¹¼È1Ñ9LØ!Ÿ;š; q™>œ>¨QÑ.°·²¸A±´À!Ñ0CðDñ Eð EðIð		IðIð Ið Iñ Iô Ið Ið Ið Ið Ið Ið Iøøøð Ið Ið Ið Ið €Ms   ÂC8FÆFÆFc                 ó&  — |                       ¦   «         }|dk     rt          d¦  «        ‚|                      d¦  «        }|                      d¦  «        }d}|                       ¦   «         dk    r| j        dd …         D ]}||z  }Œ||z  }||z  }||fS )Nr!   zNFan in and fan out can not be computed for tensor with fewer than 2 dimensionsr$   r   )ÚdimrM   ro   ri   )r   rr   Únum_input_fmapsÚnum_output_fmapsÚreceptive_field_sizeÚsÚfan_inÚfan_outs           r   Ú_calculate_fan_in_and_fan_outr�   #  s©   € Ø—’‘”€JØ�A‚~€~ÝÐiÑjÔjÐjà—k’k !‘n”n€OØ—{’{ 1‘~”~ÐØÐØ‡z‚z�|„|�aÒÐð ”˜a˜b˜bÔ!ð 	&ð 	&ˆAØ  AÑ%Ð Ð ØÐ3Ñ3€FØÐ!5Ñ5€Gà�7ˆ?Ðr    Úgainc                 óÌ   — t          | ¦  «        \  }}|t          j        dt          ||z   ¦  «        z  ¦  «        z  }t          j        d¦  «        |z  }t	          | | |¦  «        S )a©  Fills the input `Tensor` with values according to the method
    described in `Understanding the difficulty of training deep feedforward
    neural networks` - Glorot, X. & Bengio, Y. (2010), using a uniform
    distribution. The resulting tensor will have values sampled from
    :math:`\mathcal{U}(-a, a)` where

    .. math::
        a = \text{gain} \times \sqrt{\frac{6}{\text{fan\_in} + \text{fan\_out}}}

    Also known as Glorot initialization.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        gain: an optional scaling factor

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.xavier_uniform_(w, gain=nn.init.calculate_gain('relu'))
    r   ç      @)r�   r   r   rL   r   )r   r‚   r   r€   r   r   s         r   Úxavier_uniform_r…   6  sa   € õ( 4°FÑ;Ô;�O€FˆGØ
•”˜3¥ v°Ñ'7Ñ!8Ô!8Ñ8Ñ9Ô9Ñ
9€CÝŒ	�#‰Œ˜Ñ€Aå˜V a R¨Ñ+Ô+Ð+r    c                 óœ   — t          | ¦  «        \  }}|t          j        dt          ||z   ¦  «        z  ¦  «        z  }t	          | d|¦  «        S )a•  Fills the input `Tensor` with values according to the method
    described in `Understanding the difficulty of training deep feedforward
    neural networks` - Glorot, X. & Bengio, Y. (2010), using a normal
    distribution. The resulting tensor will have values sampled from
    :math:`\mathcal{N}(0, \text{std}^2)` where

    .. math::
        \text{std} = \text{gain} \times \sqrt{\frac{2}{\text{fan\_in} + \text{fan\_out}}}

    Also known as Glorot initialization.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        gain: an optional scaling factor

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.xavier_normal_(w)
    r   rS   )r�   r   r   rL   r   )r   r‚   r   r€   r   s        r   Úxavier_normal_r‡   Q  sM   € õ( 4°FÑ;Ô;�O€FˆGØ
•”˜3¥ v°Ñ'7Ñ!8Ô!8Ñ8Ñ9Ô9Ñ
9€Cå˜F B¨Ñ,Ô,Ð,r    c                 óœ   — |                      ¦   «         }ddg}||vrt          d|› d|› �¦  «        ‚t          | ¦  «        \  }}|dk    r|n|S )Nr   r€   zMode z" not supported, please use one of )ÚlowerrM   r�   )r   ÚmodeÚvalid_modesr   r€   s        r   Ú_calculate_correct_fanrŒ   k  sh   € Ø�:Š:‰<Œ<€DØ˜YÐ'€KØ�;ÐÐÝÐV ÐVÐVÈÐVÐVÑWÔWÐWå3°FÑ;Ô;�O€FˆGØ˜XÒ%Ð%ˆ6ˆ6¨7Ð2r    r   rF   rŠ   rN   c                 óø  — t           j                             | ¦  «        r+t           j                             t          | f| |||¬¦  «        S d| j        v rt          j        d¦  «         | S t          | |¦  «        }t          ||¦  «        }|t          j        |¦  «        z  }t          j        d¦  «        |z  }t          j        ¦   «         5  |                      | |¦  «        cddd¦  «         S # 1 swxY w Y   dS )a¬  Fills the input `Tensor` with values according to the method
    described in `Delving deep into rectifiers: Surpassing human-level
    performance on ImageNet classification` - He, K. et al. (2015), using a
    uniform distribution. The resulting tensor will have values sampled from
    :math:`\mathcal{U}(-\text{bound}, \text{bound})` where

    .. math::
        \text{bound} = \text{gain} \times \sqrt{\frac{3}{\text{fan\_mode}}}

    Also known as He initialization.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        a: the negative slope of the rectifier used after this layer (only
            used with ``'leaky_relu'``)
        mode: either ``'fan_in'`` (default) or ``'fan_out'``. Choosing ``'fan_in'``
            preserves the magnitude of the variance of the weights in the
            forward pass. Choosing ``'fan_out'`` preserves the magnitudes in the
            backwards pass.
        nonlinearity: the non-linear function (`nn.functional` name),
            recommended to use only with ``'relu'`` or ``'leaky_relu'`` (default).

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.kaiming_uniform_(w, mode='fan_in', nonlinearity='relu')
    )r   r   rŠ   rN   r   ú,Initializing zero-element tensors is a no-opr„   N)r   rV   rW   rX   Úkaiming_uniform_ri   r)   r*   rŒ   rR   r   r   r   r	   )r   r   rŠ   rN   Úfanr‚   r   Úbounds           r   r�   r�   u  s9  € õ: „×2Ò2°6Ñ:Ô:ð 'ÝŒ×4Ò4ÝØˆIØØØØ%ð 5ñ 'ô 'ð 	'ð 	ˆFŒLÐÐÝŒÐDÑEÔEÐEØˆÝ
  ¨Ñ
.Ô
.€CÝ˜,¨Ñ*Ô*€DØ
•”˜3‘”Ñ
€CÝŒI�c‰NŒN˜SÑ €EÝ	Œ‰Œð .ð .Ø�Š ˜v uÑ-Ô-ð.ð .ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .ð .ð .s   ÃC/Ã/C3Ã6C3c                 ó4  — d| j         v rt          j        d¦  «         | S t          | |¦  «        }t	          ||¦  «        }|t          j        |¦  «        z  }t          j        ¦   «         5  |  	                    d|¦  «        cddd¦  «         S # 1 swxY w Y   dS )a”  Fills the input `Tensor` with values according to the method
    described in `Delving deep into rectifiers: Surpassing human-level
    performance on ImageNet classification` - He, K. et al. (2015), using a
    normal distribution. The resulting tensor will have values sampled from
    :math:`\mathcal{N}(0, \text{std}^2)` where

    .. math::
        \text{std} = \frac{\text{gain}}{\sqrt{\text{fan\_mode}}}

    Also known as He initialization.

    Args:
        tensor: an n-dimensional `torch.Tensor`
        a: the negative slope of the rectifier used after this layer (only
            used with ``'leaky_relu'``)
        mode: either ``'fan_in'`` (default) or ``'fan_out'``. Choosing ``'fan_in'``
            preserves the magnitude of the variance of the weights in the
            forward pass. Choosing ``'fan_out'`` preserves the magnitudes in the
            backwards pass.
        nonlinearity: the non-linear function (`nn.functional` name),
            recommended to use only with ``'relu'`` or ``'leaky_relu'`` (default).

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.kaiming_normal_(w, mode='fan_out', nonlinearity='relu')
    r   rŽ   N)
ri   r)   r*   rŒ   rR   r   r   r   r   r   )r   r   rŠ   rN   r�   r‚   r   s          r   Úkaiming_normal_r“   ¦  sØ   € ð: 	ˆFŒLÐÐÝŒÐDÑEÔEÐEØˆÝ
  ¨Ñ
.Ô
.€CÝ˜,¨Ñ*Ô*€DØ
•”˜3‘”Ñ
€CÝ	Œ‰Œð &ð &Ø�~Š~˜a Ñ%Ô%ð&ð &ð &ð &ñ &ô &ð &ð &ð &ð &ð &ð &øøøð &ð &ð &ð &ð &ð &s   Á*BÂBÂBc                 ó  — |                       ¦   «         dk     rt          d¦  «        ‚|                      ¦   «         dk    r| S |                      d¦  «        }|                      ¦   «         |z  }|                      ||¦  «                             dd¦  «        }||k     r|                     ¦   «          t          j         	                    |¦  «        \  }}t          j
        |d¦  «        }|                     ¦   «         }||z  }||k     r|                     ¦   «          t          j        ¦   «         5  |                      |¦  «                             |¦  «         |                      |¦  «         ddd¦  «         n# 1 swxY w Y   | S )a]  Fills the input `Tensor` with a (semi) orthogonal matrix, as
    described in `Exact solutions to the nonlinear dynamics of learning in deep
    linear neural networks` - Saxe, A. et al. (2013). The input tensor must have
    at least 2 dimensions, and for tensors with more than 2 dimensions the
    trailing dimensions are flattened.

    Args:
        tensor: an n-dimensional `torch.Tensor`, where :math:`n \geq 2`
        gain: optional scaling factor

    Examples:
        >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_LAPACK)
        >>> w = torch.empty(3, 5)
        >>> nn.init.orthogonal_(w)
    r!   z4Only tensors with 2 or more dimensions are supportedr   r$   N)rg   rM   Únumelro   Únewr   Út_r   ÚlinalgÚqrÚdiagÚsignr   Úview_asÚcopy_r,   )	r   r‚   ÚrowsÚcolsÚ	flattenedÚqÚrrw   Úphs	            r   Úorthogonal_r¤   Í  sŒ  € ð  ×ÒÑÔ˜QÒÐÝÐOÑPÔPÐPà‡|‚|�~„~˜ÒÐàˆØ�;Š;�q‰>Œ>€DØ�<Š<‰>Œ>˜TÑ!€DØ—
’
˜4 Ñ&Ô&×.Ò.¨q°!Ñ4Ô4€Iàˆd‚{€{Ø�Š‰Œˆõ Œ<�?Š?˜9Ñ%Ô%�D€A€qåŒ
�1�aÑÔ€AØ	
�Š‰Œ€BØˆ�G€Aàˆd‚{€{Ø	�Š‰Œˆå	Œ‰Œð ð Ø�Š�qÑÔ×Ò Ñ"Ô"Ð"Ø�Š�DÑÔÐðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð €Ms   Ä/>E9Å9E=Æ E=rG   c                 ó¢  — |                       ¦   «         dk    rt          d¦  «        ‚| j        \  }}t          t	          j        ||z  ¦  «        ¦  «        }t          j        ¦   «         5  |                      d|¦  «         t          |¦  «        D ]'}t          j
        |¦  «        }|d|…         }d| ||f<   Œ(	 ddd¦  «         n# 1 swxY w Y   | S )aN  Fills the 2D input `Tensor` as a sparse matrix, where the
    non-zero elements will be drawn from the normal distribution
    :math:`\mathcal{N}(0, 0.01)`, as described in `Deep learning via
    Hessian-free optimization` - Martens, J. (2010).

    Args:
        tensor: an n-dimensional `torch.Tensor`
        sparsity: The fraction of elements in each column to be set to zero
        std: the standard deviation of the normal distribution used to generate
            the non-zero values

    Examples:
        >>> w = torch.empty(3, 5)
        >>> nn.init.sparse_(w, sparsity=0.1)
    r!   rd   r   N)rg   rM   ri   rK   r   Úceilr   r   r   rp   Úrandperm)	r   Úsparsityr   rž   rŸ   Ú	num_zerosÚcol_idxÚrow_indicesÚzero_indicess	            r   Úsparse_r­   ú  s  € ð  ×ÒÑÔ˜aÒÐÝÐGÑHÔHÐHà”�J€Dˆ$Ý•D”I˜h¨™oÑ.Ô.Ñ/Ô/€Iå	Œ‰Œð .ð .Ø�Š�q˜#ÑÔÐÝ˜T‘{”{ð 	.ð 	.ˆGÝœ.¨Ñ.Ô.ˆKØ& z¨	 zÔ2ˆLØ,-ˆF�< Ð(Ñ)Ð)ð	.ð.ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .ð €Ms   Á)ACÃCÃCc                 ól   ‡ ‡‡— ‰ j         Š‰d d…         Šˆ ˆˆfd„}d‰› d‰› d‰› d�|_        ‰|_         |S )Néÿÿÿÿc                  óN   •— t          j        d‰› d‰› d�d¬¦  «          ‰| i |¤ŽS )Nznn.init.z' is now deprecated in favor of nn.init.ú.r!   r"   )r)   r*   )ÚargsÚkwargsÚmethÚnew_nameÚold_names     €€€r   Údeprecated_initz(_make_deprecate.<locals>.deprecated_init  sC   ø€ ÝŒÐ] Ð]Ð]ÐRZÐ]Ð]Ð]ÐjkÐlÑlÔlÐlØˆt�TÐ$˜VÐ$Ð$Ð$r    z
    z_(...)

    .. warning::
        This method is now deprecated in favor of :func:`torch.nn.init.z"`.

    See :func:`~torch.nn.init.z` for details.)Ú__name__Ú__doc__)r´   r·   rµ   r¶   s   ` @@r   Ú_make_deprecaterº     sˆ   øøø€ ØŒ}€HØ˜˜˜Œ}€Hð%ð %ð %ð %ð %ð %ð %ð:Øð:ð :ð IQð	:ð :ð  (ð:ð :ð :€OÔð  (€OÔØÐr    r   )rS   r   )rS   r   rZ   r   N)r$   )r   )r   r   rF   )rG   ),r   r)   r   r   Útypingr   Ú	_Optionalr   r   r1   r6   r:   rR   rL   r	   r   Ú	Generatorr\   r^   r`   rb   rj   rx   r�   r…   r‡   rŒ   Ústrr�   r“   r¤   r­   rº   ÚuniformÚnormalÚconstantrh   ÚdiracÚxavier_uniformÚxavier_normalÚkaiming_uniformÚkaiming_normalÚ
orthogonalÚsparse© r    r   ú<module>rÊ      s	  ðØ €€€Ø €€€à Ð Ð Ð Ð Ð Ø €€€Ø (Ð (Ð (Ð (Ð (Ð (ð%ð %ð %ð
)ð )ð )ð
 ð  ð  ð  ðF!ð !ð !ð
ð ð ð
4Eð 4Eð 4Eð 4Eðn+ð +�Vð + ð +¨uð +¸fð +ð +ð +ð +ð$/ð /�Fð / %ð /°5ð /À&ð /ð /ð /ð /ð& ØØØØ,0ðPð PØðPà
ðPð 
ðPð ð	Pð
 ðPð ˜œÔ)ðPð ðPð Pð Pð Pð:'�fð ' 5ð '¨Vð 'ð 'ð 'ð 'ð 
&�&ð 
&˜Vð 
&ð 
&ð 
&ð 
&ð
"�6ð 
"˜fð 
"ð 
"ð 
"ð 
"ðð ð ð((ð (ð (ð (ðVð ð ð&,ð ,˜Fð ,¨%ð ,¸ð ,ð ,ð ,ð ,ð6-ð -˜6ð -¨ð -¸ð -ð -ð -ð -ð43ð 3ð 3ð MYð..ð ..Øð..Øð..Ø(+ð..ØFIð..ð ..ð ..ð ..ðd MYð$&ð $&Øð$&Øð$&Ø(+ð$&ØFIð$&ð $&ð $&ð $&ðN*ð *ð *ð *ðZð ð ð ð@ð ð ð& ˆ/˜(Ñ
#Ô
#€Ø	ˆ˜Ñ	!Ô	!€Øˆ?˜9Ñ%Ô%€Ø€o�dÑÔ€Øˆ˜ÑÔ€Ø � Ñ1Ô1€Ø� Ñ/Ô/€Ø!�/Ð"2Ñ3Ô3€Ø � Ñ1Ô1€Øˆ_˜[Ñ)Ô)€
Ø	ˆ˜Ñ	!Ô	!€€€r    