o
    ˜šÍhB'  ã                   @  s–  d dl mZ d dlmZmZmZmZmZ er*ddlm	Z	m
Z
mZmZmZ d dlmZ ddlmZ d dlZdd	„ Zdddd
œdRdd„Z		dSdddœdTdd„ZdddœdUd!d"„ZdddœdVd$d%„Z	dWd ddd&œdXd,d-„ZdYd/d0„ZdddœdZd2d3„Zdddœd[d4d5„Zddd6d7œd\d;d<„Zd=d>œd]dCdD„ZdddœdUdEdF„ZdddœdVdGdH„Z d dIœd^dJdK„Z!d dIœd^dLdM„Z"dddœdUdNdO„Z#dddœdVdPdQ„Z$dS )_é    )Úannotations)ÚTYPE_CHECKINGÚListÚOptionalÚTupleÚUnioné   )ÚArrayÚDeviceÚDtypeÚNestedSequenceÚSupportsBufferProtocol)ÚSequence)Ú_all_dtypesNc                 C  s$   dt  D ]	}| |u r d S qtdƒ‚)N©Nz)dtype must be one of the supported dtypes)r   Ú
ValueError)ÚdtypeÚd© r   úd/home/www/facesmatcher.com/frenv/lib/python3.10/site-packages/numpy/array_api/_creation_functions.pyÚ_check_valid_dtype   s
   ÿr   )r   ÚdeviceÚcopyÚobjúZUnion[Array, bool, int, float, NestedSequence[bool | int | float], SupportsBufferProtocol]r   úOptional[Dtype]r   úOptional[Device]r   ú#Optional[Union[bool, np._CopyMode]]Úreturnr	   c               C  sÐ   ddl m} t|ƒ |dvrtd|›�ƒ‚|dtjjfv r!tdƒ‚t| |ƒrG|dur1| j	|kr1d}|dtjj
fv rE| tj| jd|d	�¡S | S |du r\t| tƒr\| d
ksX| dk r\tdƒ‚tj| |d�}| |¡S )z~
    Array API compatible wrapper for :py:func:`np.asarray <numpy.asarray>`.

    See its docstring for more information.
    r   ©r	   ©ÚcpuNúUnsupported device Fz!copy=False is not yet implementedNT)r   r   l            lûÿÿÿ         z&Integer out of bounds for array dtypes©r   )Ú_array_objectr	   r   r   ÚnpZ	_CopyModeZ	IF_NEEDEDÚNotImplementedErrorÚ
isinstancer   ZALWAYSÚ_newÚarrayÚ_arrayÚintÚOverflowErrorÚasarray)r   r   r   r   r	   Úresr   r   r   r-      s    
"
r-   )r   r   ÚstopúOptional[Union[int, float]]ÚstepúUnion[int, float]Ústartc               C  óB   ddl m} t|ƒ |dvrtd|›�ƒ‚| tj| |||d�¡S )z|
    Array API compatible wrapper for :py:func:`np.arange <numpy.arange>`.

    See its docstring for more information.
    r   r   r    r"   )r/   r1   r   )r$   r	   r   r   r(   r%   Úarange)r3   r/   r1   r   r   r	   r   r   r   r5   K   ó
   r5   ÚshapeúUnion[int, Tuple[int, ...]]c                C  ó>   ddl m} t|ƒ |dvrtd|›�ƒ‚| tj| |d�¡S )zz
    Array API compatible wrapper for :py:func:`np.empty <numpy.empty>`.

    See its docstring for more information.
    r   r   r    r"   r#   )r$   r	   r   r   r(   r%   Úempty©r7   r   r   r	   r   r   r   r:   a   ó
   r:   Úxc               C  ó@   ddl m} t|ƒ |dvrtd|›�ƒ‚| tj| j|d�¡S )z„
    Array API compatible wrapper for :py:func:`np.empty_like <numpy.empty_like>`.

    See its docstring for more information.
    r   r   r    r"   r#   )r$   r	   r   r   r(   r%   Ú
empty_liker*   ©r=   r   r   r	   r   r   r   r?   t   ó
   r?   )Úkr   r   Ún_rowsr+   Ún_colsúOptional[int]rB   c               C  r4   )zv
    Array API compatible wrapper for :py:func:`np.eye <numpy.eye>`.

    See its docstring for more information.
    r   r   r    r"   )ÚMrB   r   )r$   r	   r   r   r(   r%   Úeye)rC   rD   rB   r   r   r	   r   r   r   rG   „   r6   rG   Úobjectc                C  s   ddl m} | t | ¡¡S )Nr   r   )r$   r	   r(   r%   Úfrom_dlpack)r=   r	   r   r   r   rI   š   s   rI   Ú
fill_valuec                C  sp   ddl m} t|ƒ |dvrtd|›�ƒ‚t||ƒr"|jdkr"|j}tj| ||d�}|j	t
vr3tdƒ‚| |¡S )zx
    Array API compatible wrapper for :py:func:`np.full <numpy.full>`.

    See its docstring for more information.
    r   r   r    r"   r   r#   zInvalid input to full)r$   r	   r   r   r'   Úndimr*   r%   Úfullr   r   Ú	TypeErrorr(   )r7   rJ   r   r   r	   r.   r   r   r   rL       s   

rL   c               C  sX   ddl m} t|ƒ |dvrtd|›�ƒ‚tj| j||d�}|jtvr't	dƒ‚| 
|¡S )z‚
    Array API compatible wrapper for :py:func:`np.full_like <numpy.full_like>`.

    See its docstring for more information.
    r   r   r    r"   r#   zInvalid input to full_like)r$   r	   r   r   r%   Ú	full_liker*   r   r   rM   r(   )r=   rJ   r   r   r	   r.   r   r   r   rN   »   s   

rN   T)r   r   ÚendpointÚnumrO   Úboolc            	   C  sD   ddl m} t|ƒ |dvrtd|›�ƒ‚| tj| ||||d�¡S )z€
    Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`.

    See its docstring for more information.
    r   r   r    r"   )r   rO   )r$   r	   r   r   r(   r%   Úlinspace)r3   r/   rP   r   r   rO   r	   r   r   r   rR   Õ   s
   rR   Zxy)ÚindexingÚarraysrS   ÚstrúList[Array]c                   sR   ddl m‰  tdd„ |D ƒƒdkrtdƒ‚‡ fdd„tjdd„ |D ƒd	| iŽD ƒS )
z€
    Array API compatible wrapper for :py:func:`np.meshgrid <numpy.meshgrid>`.

    See its docstring for more information.
    r   r   c                 S  s   h | ]}|j ’qS r   r#   ©Ú.0Úar   r   r   Ú	<setcomp>÷   ó    zmeshgrid.<locals>.<setcomp>z,meshgrid inputs must all have the same dtypec                   s   g | ]}ˆ   |¡‘qS r   )r(   )rX   r)   r   r   r   Ú
<listcomp>ú   s    ÿÿzmeshgrid.<locals>.<listcomp>c                 S  s   g | ]}|j ‘qS r   )r*   rW   r   r   r   r\   ü   r[   rS   )r$   r	   Úlenr   r%   Úmeshgrid)rS   rT   r   r   r   r^   ì   s   
þr^   c                C  r9   )zx
    Array API compatible wrapper for :py:func:`np.ones <numpy.ones>`.

    See its docstring for more information.
    r   r   r    r"   r#   )r$   r	   r   r   r(   r%   Úonesr;   r   r   r   r_      r<   r_   c               C  r>   )z‚
    Array API compatible wrapper for :py:func:`np.ones_like <numpy.ones_like>`.

    See its docstring for more information.
    r   r   r    r"   r#   )r$   r	   r   r   r(   r%   Ú	ones_liker*   r@   r   r   r   r`     rA   r`   ©rB   c               C  ó4   ddl m} | jdk rtdƒ‚| tj| j|d�¡S )zx
    Array API compatible wrapper for :py:func:`np.tril <numpy.tril>`.

    See its docstring for more information.
    r   r   é   z)x must be at least 2-dimensional for trilra   )r$   r	   rK   r   r(   r%   Útrilr*   ©r=   rB   r	   r   r   r   rd   #  ó   
rd   c               C  rb   )zx
    Array API compatible wrapper for :py:func:`np.triu <numpy.triu>`.

    See its docstring for more information.
    r   r   rc   z)x must be at least 2-dimensional for triura   )r$   r	   rK   r   r(   r%   Útriur*   re   r   r   r   rg   1  rf   rg   c                C  r9   )zz
    Array API compatible wrapper for :py:func:`np.zeros <numpy.zeros>`.

    See its docstring for more information.
    r   r   r    r"   r#   )r$   r	   r   r   r(   r%   Úzerosr;   r   r   r   rh   ?  r<   rh   c               C  r>   )z„
    Array API compatible wrapper for :py:func:`np.zeros_like <numpy.zeros_like>`.

    See its docstring for more information.
    r   r   r    r"   r#   )r$   r	   r   r   r(   r%   Ú
zeros_liker*   r@   r   r   r   ri   R  rA   ri   )
r   r   r   r   r   r   r   r   r   r	   )Nr   )r/   r0   r1   r2   r3   r2   r   r   r   r   r   r	   )r7   r8   r   r   r   r   r   r	   )r=   r	   r   r   r   r   r   r	   r   )rC   r+   rD   rE   rB   r+   r   r   r   r   r   r	   )r=   rH   r   r	   )
r7   r8   rJ   r2   r   r   r   r   r   r	   )
rJ   r2   r=   r	   r   r   r   r   r   r	   )rP   r+   r3   r2   r/   r2   r   r   r   r   rO   rQ   r   r	   )rT   r	   rS   rU   r   rV   )r=   r	   rB   r+   r   r	   )%Ú
__future__r   Útypingr   r   r   r   r   Z_typingr	   r
   r   r   r   Úcollections.abcr   Z_dtypesr   Únumpyr%   r   r-   r5   r:   r?   rG   rI   rL   rN   rR   r^   r_   r`   rd   rg   rh   ri   r   r   r   r   Ú<module>   sj    ó/üùüÿþù

û ú øüÿüÿ