§
    �Štj|/  ã                   ó6  — d Z ddlZddlZddlZddlZddlmZ ddlZej	        ej
        ej        ej        ej        ej        ej        ej        gZej        ej        ej        ej        gZej        ej        ej        ej        gZej        ej        ej        gZej         ge¢Z!g e¢e¢Z"dej#        de$de$dej#        fd„Z%ddd	d	d	dd
œde&ej'        z  e(e&         z  e)e&df         z  dej*        de+ej,        z  de$dz  de$dz  de de de dej-        dz  dej#        fd„Z.dS )z1
This module contains tensor creation utilities.
é    N)ÚcastÚtÚlowÚhighÚreturnc                 óÖ   — ||z
  t          j        | j        ¦  «        j        k    r/|                      |dz  |dz  ¦  «                             d¦  «        S |                      ||¦  «        S )Né   )ÚtorchÚfinfoÚdtypeÚmaxÚuniform_Úmul_)r   r   r   s      úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/torch/testing/_creation.pyÚ_uniform_random_r   $   s`   € ð ˆc�z•U”[ ¤Ñ)Ô)Ô-Ò-Ð-Ø�zŠz˜# ™' 4¨!¡8Ñ,Ô,×1Ò1°!Ñ4Ô4Ð4à�zŠz˜#˜tÑ$Ô$Ð$ó    F)r   r   Úrequires_gradÚnoncontiguousÚexclude_zeroÚmemory_formatÚshape.r   Údevicer   r   r   r   c                 óÖ  ‡ — dt           dz  dt           dz  dt           dt           dt           dt           dt          t           t           f         fˆ fd	„}	t          |¦  «        d
k    r-t          |d         t          j        j        ¦  «        r|d         }t          t          t          df         t          |¦  «        ¦  «        }|r|�t          d|›d|›�¦  «        ‚|r‰ t          v rt          d‰ ›�¦  «        ‚|ot          j        d„ |d
¦  «        d
k    }|r8t          t          t          df         g |dd…         ¢d|d         z  ‘R ¦  «        }‰ t          j        u rTt          t          t          t          f          |	||dddd¬¦  «        ¦  «        \  }}t          j        ||||‰ ¬¦  «        }
�nÕ‰ t          v r•t          t          t          t          f          |	||t          j        ‰ ¦  «        j        t          j        ‰ ¦  «        j        ‰ t          j        urd
ndz   dd¬¦  «        ¦  «        \  }}t          j        ||||‰ ¬¦  «        }
�n7‰ t(          v rˆ |	||t          j        ‰ ¦  «        j        t          j        ‰ ¦  «        j        dd¬¦  «        \  }}t          j        ||‰ ¬¦  «        }
t/          ‰ t0          v rt          j        |
¦  «        n|
||¦  «         n¦‰ t4          v rŠ |	||t          j        ‰ ¦  «        j        t          j        ‰ ¦  «        j        dd¬¦  «        \  }}t          j        ||t          j        ¬¦  «        }
t/          |
||¦  «         |
                     ‰ ¦  «        }
nt;          d‰ › d�¦  «        ‚|r|
dd
dd…f         }
n|�|
                     |¬¦  «        }
|r+‰ t          v rd
nt          j        ‰ ¦  «        j        |
|
dk    <   ‰ t(          v r||
_         |
S )as  Creates a tensor with the given :attr:`shape`, :attr:`device`, and :attr:`dtype`, and filled with
    values uniformly drawn from ``[low, high)``.

    If :attr:`low` or :attr:`high` are specified and are outside the range of the :attr:`dtype`'s representable
    finite values then they are clamped to the lowest or highest representable finite value, respectively.
    If ``None``, then the following table describes the default values for :attr:`low` and :attr:`high`,
    which depend on :attr:`dtype`.

    +---------------------------+------------+----------+
    | ``dtype``                 | ``low``    | ``high`` |
    +===========================+============+==========+
    | boolean type              | ``0``      | ``2``    |
    +---------------------------+------------+----------+
    | unsigned integral type    | ``0``      | ``10``   |
    +---------------------------+------------+----------+
    | signed integral types     | ``-9``     | ``10``   |
    +---------------------------+------------+----------+
    | floating types            | ``-9``     | ``9``    |
    +---------------------------+------------+----------+
    | complex types             | ``-9``     | ``9``    |
    +---------------------------+------------+----------+

    Args:
        shape (Tuple[int, ...]): Single integer or a sequence of integers defining the shape of the output tensor.
        dtype (:class:`torch.dtype`): The data type of the returned tensor.
        device (Union[str, torch.device]): The device of the returned tensor.
        low (Optional[Number]): Sets the lower limit (inclusive) of the given range. If a number is provided it is
            clamped to the least representable finite value of the given dtype. When ``None`` (default),
            this value is determined based on the :attr:`dtype` (see the table above). Default: ``None``.
        high (Optional[Number]): Sets the upper limit (exclusive) of the given range. If a number is provided it is
            clamped to the greatest representable finite value of the given dtype. When ``None`` (default) this value
            is determined based on the :attr:`dtype` (see the table above). Default: ``None``.

            .. deprecated:: 2.1

                Passing ``low==high`` to :func:`~torch.testing.make_tensor` for floating or complex types is deprecated
                since 2.1 and will be removed in 2.3. Use :func:`torch.full` instead.

        requires_grad (Optional[bool]): If autograd should record operations on the returned tensor. Default: ``False``.
        noncontiguous (Optional[bool]): If `True`, the returned tensor will be noncontiguous. This argument is
            ignored if the constructed tensor has fewer than two elements. Mutually exclusive with ``memory_format``.
        exclude_zero (Optional[bool]): If ``True`` then zeros are replaced with the dtype's small positive value
            depending on the :attr:`dtype`. For bool and integer types zero is replaced with one. For floating
            point types it is replaced with the dtype's smallest positive normal number (the "tiny" value of the
            :attr:`dtype`'s :func:`~torch.finfo` object), and for complex types it is replaced with a complex number
            whose real and imaginary parts are both the smallest positive normal number representable by the complex
            type. Default ``False``.
        memory_format (Optional[torch.memory_format]): The memory format of the returned tensor. Mutually exclusive
            with ``noncontiguous``.

    Raises:
        ValueError: If ``requires_grad=True`` is passed for integral `dtype`
        ValueError: If ``low >= high``.
        ValueError: If either :attr:`low` or :attr:`high` is ``nan``.
        ValueError: If both :attr:`noncontiguous` and :attr:`memory_format` are passed.
        TypeError: If :attr:`dtype` isn't supported by this function.

    Examples:
        >>> # xdoctest: +SKIP
        >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA)
        >>> from torch.testing import make_tensor
        >>> # Creates a float tensor with values in [-1, 1)
        >>> make_tensor((3,), device="cpu", dtype=torch.float32, low=-1, high=1)
        >>> # xdoctest: +SKIP
        tensor([ 0.1205, 0.2282, -0.6380])
        >>> # Creates a bool tensor on CUDA
        >>> make_tensor((2, 2), device="cuda", dtype=torch.bool)
        tensor([[False, False],
                [False, True]], device='cuda:0')
    r   Nr   Úlowest_inclusiveÚhighest_exclusiveÚdefault_lowÚdefault_highr   c                ó>  •— dt           dt           dt           dt           fd„}| �| n|} |�|n|}t          d„ | |fD ¦   «         ¦  «        rt          d| ›d	|›�¦  «        ‚| |k    r&‰t          v rt	          j        d
t          d¬¦  «         nF| |k    rt          d| › d|› �¦  «        ‚||k     s| |k    rt          d| › d|› d‰› d|› d|› d�¦  «        ‚ || ||¦  «        }  ||||¦  «        }‰t          v r(t          j	        | ¦  «        t          j	        |¦  «        fS | |fS )z–
        Modifies (and raises ValueError when appropriate) low and high values given by the user (input_low, input_high)
        if required.
        ÚaÚlÚhr   c                 ó>   — t          t          | |¦  «        |¦  «        S ©N)Úminr   )r   r    r!   s      r   Úclampz3make_tensor.<locals>.modify_low_high.<locals>.clamp�   s   € Ý•s˜1˜a‘y”y !Ñ$Ô$Ð$r   Nc              3   óh   K  — | ]-}t          |t          ¦  «        ot          j        |¦  «        V — Œ.d S r#   )Ú
isinstanceÚfloatÚmathÚisnan)Ú.0Úvalues     r   ú	<genexpr>z7make_tensor.<locals>.modify_low_high.<locals>.<genexpr>“   s;   è è € ÐWÐWÀ%�z˜%¥Ñ'Ô'Ð=­D¬J°uÑ,=Ô,=ÐWÐWÐWÐWÐWÐWr   z,`low` and `high` cannot be NaN, but got low=z
 and high=z£Passing `low==high` to `torch.testing.make_tensor` for floating or complex types is deprecated since 2.1 and will be removed in 2.3. Use `torch.full(...)` instead.é   )Ú
stacklevelz(`low` must be less than `high`, but got z >= z5The value interval specified by `low` and `high` is [z, z), but z only supports [ú))
r(   ÚanyÚ
ValueErrorÚ_FLOATING_OR_COMPLEX_TYPESÚwarningsÚwarnÚFutureWarningÚ_BOOLEAN_OR_INTEGRAL_TYPESr)   Úceil)r   r   r   r   r   r   r%   r   s          €r   Úmodify_low_highz$make_tensor.<locals>.modify_low_high   sâ  ø€ ð	%•Uð 	%�uð 	%­ð 	%µ5ð 	%ð 	%ð 	%ð 	%ð �_ˆcˆc¨+ˆØÐ'ˆtˆt¨\ˆåÐWÐWÈCÐQUÈ;ÐWÑWÔWÑWÔWð 	ÝØM¸3ÐMÐMÀdÐMÐMñô ð ð �DŠ[ˆ[˜UÕ&@Ð@Ð@ÝŒMð1õ Øðñ ô ð ð ð �DŠ[ˆ[ÝÐWÈÐWÐWÐQUÐWÐWÑXÔXÐXØÐ$Ò$Ð$¨Ð/@Ò(@Ð(@ÝðWÈð Wð WÈtð Wð WØðWð WØ.>ðWð WØBSðWð Wð Wñô ð ð
 ˆe�CÐ)Ð+<Ñ=Ô=ˆØˆu�TÐ+Ð->Ñ?Ô?ˆàÕ.Ð.Ð.õ ”9˜S‘>”>¥4¤9¨T¡?¤?Ð2Ð2à�DˆyÐr   é   r   .zaThe parameters `noncontiguous` and `memory_format` are mutually exclusive, but got noncontiguous=z and memory_format=zU`requires_grad=True` is not supported for boolean and integral dtypes, but got dtype=c                 ó   — | |z  S r#   © )ÚxÚys     r   ú<lambda>zmake_tensor.<locals>.<lambda>Á   s
   € ÀAÈÁE€ r   éÿÿÿÿr	   )r   r   r   r   )r   r   i÷ÿÿÿé
   é	   zThe requested dtype 'z‚' is not supported by torch.testing.make_tensor(). To request support, file an issue at: https://github.com/pytorch/pytorch/issues)r   )!r(   ÚtupleÚlenr'   ÚcollectionsÚabcÚSequencer   Úintr2   r7   Ú	functoolsÚreducer
   ÚboolÚrandintÚiinfor$   r   Úint64r3   r   Úemptyr   Ú_COMPLEX_TYPESÚview_as_realÚ_FLOATING_8BIT_TYPESÚfloat32ÚtoÚ	TypeErrorÚcloneÚtinyr   )r   r   r   r   r   r   r   r   r   r9   Úresults   `          r   Úmake_tensorrY   -   s™  ø€ ðd1Ý�T‰\ð1å�d‰lð1õ  ð	1õ
 !ð1õ ð1õ ð1õ 
�u•eˆ|Ô	ð1ð 1ð 1ð 1ð 1ð 1õf ˆ5�z„z�Q‚€�: e¨A¤hµ´Ô0HÑIÔI€Ø�a”ˆÝ••s˜C�x”¥%¨¡,¤,Ñ/Ô/€Eàð 
˜Ð2Ýð=Ø$ð=ð =Ø,9ð=ð =ñ
ô 
ð 	
ð
 ð 
˜Õ"<Ð<Ð<ÝØfÐ^cÐfÐfñ
ô 
ð 	
ð "ÐX¥iÔ&6Ð7IÐ7IÈ5ÐRSÑ&TÔ&TÐWXÒ&X€MØð Dõ •U�3 ˜8”_Ð&B¨¨c¨r¨c¬
Ð&B°A¸¸b¼	±MÐ&BÐ&BÑCÔCˆà•”
ÐÐÝÝ•#•s�(ŒOØˆOØØØ!"Ø"#ØØðñ ô ñ

ô 

‰	ˆˆTõ ”˜s D¨%¸ÀeÐLÑLÔLˆ‰Ø	Õ,Ð	,Ð	,ÝÝ•#•s�(ŒOØˆOØØÝ!&¤¨UÑ!3Ô!3Ô!7Ý"'¤+¨eÑ"4Ô"4Ô"8ð ¥U¤[Ð0Ð0�1�1°añ	#9ð Øðñ ô ñ
ô 
‰	ˆˆTõ" ”˜s D¨%¸ÀeÐLÑLÔLˆ‰Ø	Õ,Ð	,Ð	,Ø#�OØØÝ"œ[¨Ñ/Ô/Ô3Ý#œk¨%Ñ0Ô0Ô4ØØð
ñ 
ô 
‰	ˆˆTõ ”˜U¨6¸Ð?Ñ?Ô?ˆÝØ*/µ>Ð*AÐ*A�EÔ˜vÑ&Ô&Ð&ÀvÈsÐTXñ	
ô 	
ð 	
ð 	
ð 
Õ&Ð	&Ð	&Ø#�OØØÝ"œ[¨Ñ/Ô/Ô3Ý#œk¨%Ñ0Ô0Ô4ØØð
ñ 
ô 
‰	ˆˆTõ ”˜U¨6½¼ÐGÑGÔGˆÝ˜  dÑ+Ô+Ð+Ø—’˜5Ñ!Ô!ˆˆåð_ Eð _ð _ð _ñ
ô 
ð 	
ð
 ð ;à˜˜Q˜T ˜T˜	Ô"ˆˆØ	Ð	"Ø—’¨M�Ñ:Ô:ˆàð 
àÕ4Ð4Ð4ˆAˆA½%¼+ÀeÑ:LÔ:LÔ:Qð 	ˆv˜Š{Ñð Õ*Ð*Ð*Ø,ˆÔà€Mr   )/Ú__doc__Úcollections.abcrE   rI   r)   r4   Útypingr   r
   Úuint8Úint8Úint16Úint32rN   Úuint16Úuint32Úuint64Ú_INTEGRAL_TYPESÚfloat16Úbfloat16rS   Úfloat64Ú_FLOATING_TYPESÚfloat8_e4m3fnÚfloat8_e5m2Úfloat8_e4m3fnuzÚfloat8_e5m2fnuzrR   Ú	complex32Ú	complex64Ú
complex128rP   rK   r7   r3   ÚTensorr(   r   rH   ÚSizeÚlistrC   r   Ústrr   r   rY   r<   r   r   ú<module>rt      s  ððð ð Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð à €€€ð 
„KØ	„JØ	„KØ	„KØ	„KØ	„LØ	„LØ	„Lð	€ð ”= %¤.°%´-ÀÄÐO€à	ÔØ	ÔØ	ÔØ	Ôð	Ð ð ”/ 5¤?°EÔ4DÐE€Ø#œjÐ;¨?Ð;Ð Ø@˜Ð@°Ð@Ð ð%˜œð %¨5ð %¸ð %À%Ä,ð %ð %ð %ð %ð ØØØØØ04ðgð gð gØ�%”*Ñ˜t CœyÑ(¨5°°c°¬?Ñ:ðgàŒ;ðgð �%”,Ñðgð 
�‰ð	gð
 �$‰,ðgð ðgð ðgð ðgð Ô&¨Ñ-ðgð „\ðgð gð gð gð gð gr   