ó
    "Eñi¦/  ã                   óD  • S r SSKrSSKrSSKrSSKrSSKJrJrJ	r	  SSK
r
\
R                  \
R                  \
R                  \
R                  \
R                  \
R                   \
R"                  \
R$                  /r\
R(                  \
R*                  \
R,                  \
R.                  /r\
R2                  \
R4                  \
R6                  \
R8                  /r\
R<                  \
R>                  \
R@                  /r!\
RD                  /\Qr#/ \Q\!Qr$S\
RJ                  S\&S\&S\
RJ                  4S jr'SSS	S	S	SS
.S\	\(\
RR                  \*\(   \+\(S4   4   S\
RX                  S\	\-\
R\                  4   S\\&   S\\&   S\"S\"S\"S\\
R^                     S\
RJ                  4S jjr0g)z1
This module contains tensor creation utilities.
é    N)ÚcastÚOptionalÚUnionÚtÚlowÚhighÚreturnc                 óÒ   • X!-
  [         R                  " U R                  5      R                  :¼  a'  U R	                  US-  US-  5      R                  S5      $ U R	                  X5      $ )Né   )ÚtorchÚfinfoÚdtypeÚmaxÚuniform_Úmul_)r   r   r   s      ÚT/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/testing/_creation.pyÚ_uniform_random_r   $   sT   € ð �z”U—[’[ §¡Ó)×-Ñ-Ó-Ø�z‰z˜# ™' 4¨!¡8Ó,×1Ñ1°!Ó4Ð4à�z‰z˜#Ó$Ð$ó    F)r   r   Úrequires_gradÚnoncontiguousÚexclude_zeroÚmemory_formatÚshape.r   Údevicer   r   r   r   c                 ó°  ^ • S[         [           S[         [           S[        S[        S[        S[        S[        [        [        4   4U 4S jjn	[        U5      S	:X  a1  [	        US
   [
        R                  R                  5      (       a  US
   n[        [        [        S4   [        U5      5      nU(       a  Ub  [        SU< SU< 35      eU(       a  T [        ;   a  [        ST < 35      eU=(       a    [        R                  " S US	5      S	:„  nU(       a'  [        [        [        S4   / USS QSUS   -  P75      nT [        R                  L a@  [        [        [        [        4   U	" UUS
SS
SS95      u  p#[        R                   " X#X�T S9n
GOÖT [        ;   a”  [        [        [        [        4   U	" UU[        R"                  " T 5      R$                  [        R"                  " T 5      R&                  T [        R(                  La  S	OS
-   SSS95      u  p#[        R                   " X#X�T S9n
GO8T [*        ;   a‹  U	" UU[        R,                  " T 5      R$                  [        R,                  " T 5      R&                  SSS9u  p#[        R.                  " X�T S9n
[1        T [2        ;   a  [        R4                  " U
5      OU
X#5        O£T [6        ;   aŠ  U	" UU[        R,                  " T 5      R$                  [        R,                  " T 5      R&                  SSS9u  p#[        R.                  " X�[        R8                  S9n
[1        X¢U5        U
R;                  T 5      n
O[=        ST  S35      eU(       a  U
SS	SS24   n
OUb  U
R?                  US9n
U(       a1  T [        ;   a  S	O[        R,                  " T 5      R@                  XªS
:H  '   T [*        ;   a  XJl!        U
$ )a  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   r   Úlowest_inclusiveÚhighest_exclusiveÚdefault_lowÚdefault_highr	   c                ó  >• S[         S[         S[         S[         4S jnU b  U OUn Ub  UOUn[        S X4 5       5      (       a  [        SU < SU< 35      eX:X  a%  T[        ;   a  [        R
                  " S	[        S
S9  O;X:¼  a  [        SU  SU 35      eX:  d  X:¼  a  [        SU  SU ST SU SU S35      eU" XU5      n U" XU5      nT[        ;   a,  [        R                  " U 5      [        R                  " U5      4$ X4$ )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                 ó,   • [        [        X5      U5      $ ©N)Úminr   )r!   r"   r#   s      r   ÚclampÚ3make_tensor.<locals>.modify_low_high.<locals>.clamp�   s   € Ü”s˜1“y !Ó$Ð$r   c              3   ó|   #   • U  H2  n[        U[        5      =(       a    [        R                  " U5      v •  M4     g 7fr%   )Ú
isinstanceÚfloatÚmathÚisnan)Ú.0Úvalues     r   Ú	<genexpr>Ú7make_tensor.<locals>.modify_low_high.<locals>.<genexpr>“   s(   é € ÐWÊ;À%Œz˜%¤Ó'×=¬D¯JªJ°uÓ,=Ô=Ê;ùs   ‚:<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_highÚ$make_tensor.<locals>.modify_low_high   sK  ø€ ð	%”Uð 	%œuð 	%¬ð 	%´5ô 	%ð ‘_‰c¨+ˆØÑ'‰t¨\ˆäÑWÈCÉ;ÓW×WÑWÜØ?¸3¹&ÀÀdÁWÐMóð ð ‹[˜UÔ&@Ó@Ü�MŠMð1ô Øóð ‹[ÜÐGÈÀuÈDÐQUÐPVÐWÓXÐXØÓ$¨Ó(@ÜØGÈÀuÈBÈtÈfð UØ�gÐ-Ð.>Ð-?¸rÐBSÐATÐTUðWóð ñ
 �CÐ+<Ó=ˆÙ�TÐ->Ó?ˆàÔ.Ó.ô —9’9˜S“>¤4§9¢9¨T£?Ð2Ð2àˆyÐr   é   r   .NzaThe 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                 ó
   • X-  $ r%   © )ÚxÚys     r   Ú<lambda>Úmake_tensor.<locals>.<lambda>Á   s   € ÀAÂEr   éÿÿÿÿ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   r+   ÚtupleÚlenr*   ÚcollectionsÚabcÚSequencer   Úintr6   r;   Ú	functoolsÚreducer   ÚboolÚrandintÚiinfor&   r   Úint64r7   r   Úemptyr   Ú_COMPLEX_TYPESÚview_as_realÚ_FLOATING_8BIT_TYPESÚfloat32ÚtoÚ	TypeErrorÚcloneÚtinyr   )r   r   r   r   r   r   r   r   r   r=   Úresults   `          r   Úmake_tensorr_   -   s   ø€ ðd1Ü”e‰_ð1ä”u‰oð1ô  ð	1ô
 !ð1ô ð1ô ð1ô 
Œu”eˆ|Ñ	÷1ôf ˆ5ƒz�Qƒœ: e¨A¡h´·±×0HÑ0H×IÑIØ�a‘ˆÜ””s˜C�x‘¤%¨£,Ó/€Eæ˜Ñ2Üð&Ø$Ñ&Ð&:¨MÑ+;ð=ó
ð 	
ö
 ˜Ô"<Ó<ÜØdÐ^cÑ]eÐfó
ð 	
ð "×X¤i×&6Ò&6Ñ7IÈ5ÐRSÓ&TÐWXÑ&X€MÞô ”Uœ3 ˜8‘_Ð&B¨¨c¨r¨
Ð&B°A¸¸b¹	±MÑ&BÓCˆà”—
‘
ÒÜÜ”#”s�(‰OÙØØØ!"Ø"#ØØñó

‰	ˆô —’˜s¨%ÀeÑLŠØ	Ô,Ó	,ÜÜ”#”s�(‰OÙØØÜ!&§¢¨UÓ!3×!7Ñ!7Ü"'§+¢+¨eÓ"4×"8Ñ"8ð ¤U§[¡[Ò0‘1°añ	#9ð Øñó
‰	ˆô" —’˜s¨%ÀeÑLŠØ	Ô,Ó	,Ù#ØØÜ"Ÿ[š[¨Ó/×3Ñ3Ü#Ÿkšk¨%Ó0×4Ñ4ØØñ
‰	ˆô —’˜U¸Ñ?ˆÜØ*/´>Ó*AŒE×Ò˜vÔ&ÀvÈsõ	
ð 
Ô&Ó	&Ù#ØØÜ"Ÿ[š[¨Ó/×3Ñ3Ü#Ÿkšk¨%Ó0×4Ñ4ØØñ
‰	ˆô —’˜U¼¿¹ÑGˆÜ˜ dÔ+Ø—‘˜5Ó!‰äØ# E 7ð +_ð _ó
ð 	
ö
 à˜˜Q˜T ˜T˜	Ñ"‰Ø	Ñ	"Ø—‘¨M�Ð:ˆæàÔ4Ó4‰A¼%¿+º+ÀeÓ:L×:QÑ:Qð 	˜‰{Ñð Ô*Ó*Ø,Ôà€Mr   )1Ú__doc__Úcollections.abcrK   rO   r,   r8   Útypingr   r   r   r   Úuint8Úint8Úint16Úint32rT   Úuint16Úuint32Úuint64Ú_INTEGRAL_TYPESÚfloat16Úbfloat16rY   Úfloat64Ú_FLOATING_TYPESÚfloat8_e4m3fnÚfloat8_e5m2Úfloat8_e4m3fnuzÚfloat8_e5m2fnuzrX   Ú	complex32Ú	complex64Ú
complex128rV   rQ   r;   r7   ÚTensorr+   r   rN   ÚSizeÚlistrI   r   Ústrr   r   r_   rA   r   r   Ú<module>rz      sà  ðñó Û Û Û ß (Ñ (ã ð 
‡K�KØ	‡J�JØ	‡K�KØ	‡K�KØ	‡K�KØ	‡L�LØ	‡L�LØ	‡L�Lð	€ð —=‘= %§.¡.°%·-±-ÀÇÁÐO€à	×ÑØ	×ÑØ	×ÑØ	×Ñð	Ð ð —/‘/ 5§?¡?°E×4DÑ4DÐE€Ø#Ÿj™jÐ;¨?Ð;Ð Ø@˜Ð@°Ð@Ð ð%˜Ÿ™ð %¨5ð %¸ð %À%Ç,Á,ô %ð  Ø ØØØØ37ògØ�#�u—z‘z 4¨¡9¨e°C¸°H©oÐ=Ñ>ðgà�;‰;ðgð �#�u—|‘|Ð#Ñ$ðgð 
�%‰ð	gð
 �5‰/ðgð ðgð ðgð ðgð ˜E×/Ñ/Ñ0ðgð ‡\�\ögr   