
    NgB'                    v   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 Zdddd	dAdZ	 	 dBddddCdZddddDdZddddEd Z	 dFd ddd!dGd'ZdHd)ZddddId+ZddddJd,Zddd-d.dKd2Zd3d4dLd9ZddddDd:ZddddEd;Z d d<dMd=Z!d d<dMd>Z"ddddDd?Z#ddddEd@Z$dS )N    )annotations)TYPE_CHECKINGListOptionalTupleUnion   )ArrayDeviceDtypeNestedSequenceSupportsBufferProtocol)Sequence)_all_dtypesNc                H    dt           z   D ]	}| |u r d S 
t          d          )NNz)dtype must be one of the supported dtypes)r   
ValueError)dtypeds     _/var/www/html/ai-engine/env/lib/python3.11/site-packages/numpy/array_api/_creation_functions.py_check_valid_dtyper      s<    
 {"  A::FF 
@
A
AA    )r   devicecopyobjZUnion[Array, bool, int, float, NestedSequence[bool | int | float], SupportsBufferProtocol]r   Optional[Dtype]r   Optional[Device]r   #Optional[Union[bool, np._CopyMode]]returnr
   c                 ddl m} t          |           |dvrt          d|          |dt          j        j        fv rt          d          t          | |          rP|| j	        |k    rd}|dt          j        j
        fv r* |j        t	          j        | j        d|	                    S | S |0t          | t                    r| d
k    s| dk     rt          d          t	          j        | |          } |j        |          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   np	_CopyMode	IF_NEEDEDNotImplementedError
isinstancer   ALWAYS_newarray_arrayintOverflowErrorasarray)r   r   r   r   r
   ress         r   r3   r3      s,   , %$$$$$u]""9v99:::r|-...!"EFFF#u e!3!3DD",-...5:bhszEJJJKKK
}C--}3==C*DTDT DEEE
*S
&
&
&C5:c??r   )r   r   stopOptional[Union[int, float]]stepUnion[int, float]startc                  ddl m} t          |           |dvrt          d|           |j        t          j        | |||                    S )z|
    Array API compatible wrapper for :py:func:`np.arange <numpy.arange>`.

    See its docstring for more information.
    r	   r"   r#   r%   )r5   r7   r   )r'   r
   r   r   r.   r(   arange)r9   r5   r7   r   r   r
   s         r   r;   r;   K   sk     %$$$$$u]""9v99:::5:biDt5IIIJJJr   shapeUnion[int, Tuple[int, ...]]c                   ddl m} t          |           |dvrt          d|           |j        t          j        | |                    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r<   r   r   r
   s       r   r?   r?   a   g     %$$$$$u]""9v99:::5:bhuE222333r   xc                  ddl m} t          |           |dvrt          d|           |j        t          j        | j        |                    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_liker0   rB   r   r   r
   s       r   rD   rD   t   i     %$$$$$u]""9v99:::5:bmAHE:::;;;r   )kr   r   n_rowsr1   n_colsOptional[int]rG   c                  ddl m} t          |           |dvrt          d|           |j        t          j        | |||                    S )zv
    Array API compatible wrapper for :py:func:`np.eye <numpy.eye>`.

    See its docstring for more information.
    r	   r"   r#   r%   )MrG   r   )r'   r
   r   r   r.   r(   eye)rH   rI   rG   r   r   r
   s         r   rM   rM      sk     %$$$$$u]""9v99:::5:bfVv%@@@AAAr   objectc               R    ddl m}  |j        t          j        |                     S )Nr	   r"   )r'   r
   r.   r(   from_dlpack)rB   r
   s     r   rP   rP      s0    $$$$$$5:bnQ''(((r   
fill_valuec               $   ddl m} t          |           |dvrt          d|          t	          ||          r|j        dk    r|j        }t          j        | ||          }|j	        t          vrt          d           |j        |          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,   ndimr0   r(   fullr   r   	TypeErrorr.   )r<   rQ   r   r   r
   r4   s         r   rT   rT      s     %$$$$$u]""9v99:::*e$$ 'A)=)=&

'%5
1
1
1C
y## /0005:c??r   c                  ddl m} t          |           |dvrt          d|          t	          j        | j        ||          }|j        t          vrt          d           |j
        |          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_liker0   r   r   rU   r.   )rB   rQ   r   r   r
   r4   s         r   rW   rW      s     %$$$$$u]""9v99:::
,qx5
9
9
9C
y## 45555:c??r   T)r   r   endpointnumrX   boolc         	         ddl m} t          |           |dvrt          d|           |j        t          j        | ||||                    S )z
    Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`.

    See its docstring for more information.
    r	   r"   r#   r%   )r   rX   )r'   r
   r   r   r.   r(   linspace)r9   r5   rY   r   r   rX   r
   s          r   r\   r\      sm     %$$$$$u]""9v99:::5:bk%s%(SSSTTTr   xy)indexingarraysr^   strList[Array]c                    ddl m t          d |D                       dk    rt          d          fdt	          j        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                    h | ]	}|j         
S  r&   .0as     r   	<setcomp>zmeshgrid.<locals>.<setcomp>   s    $$$AG$$$r   z,meshgrid inputs must all have the same dtypec                0    g | ]} j         |          S rd   )r.   )rf   r/   r
   s     r   
<listcomp>zmeshgrid.<locals>.<listcomp>   s5        	
5  r   c                    g | ]	}|j         
S rd   )r0   re   s     r   rj   zmeshgrid.<locals>.<listcomp>   s    "<"<"<18"<"<"<r   r^   )r'   r
   lenr   r(   meshgrid)r^   r_   r
   s     @r   rm   rm      s     %$$$$$
 $$V$$$%%))GHHH   ["<"<V"<"<"<PxPP   r   c                   ddl m} t          |           |dvrt          d|           |j        t          j        | |                    S )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@   s       r   ro   ro      sg     %$$$$$u]""9v99:::5:bge5111222r   c                  ddl m} t          |           |dvrt          d|           |j        t          j        | j        |                    S )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_liker0   rE   s       r   rq   rq     si     %$$$$$u]""9v99:::5:bl185999:::r   rG   c                  ddl m} | j        dk     rt          d           |j        t          j        | j        |                    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 trilrr   )r'   r
   rS   r   r.   r(   trilr0   rB   rG   r
   s      r   ru   ru   #  S     %$$$$$vzzDEEE5:bgah!,,,---r   c                  ddl m} | j        dk     rt          d           |j        t          j        | j        |                    S )zx
    Array API compatible wrapper for :py:func:`np.triu <numpy.triu>`.

    See its docstring for more information.
    r	   r"   rt   z)x must be at least 2-dimensional for triurr   )r'   r
   rS   r   r.   r(   triur0   rv   s      r   ry   ry   1  rw   r   c                   ddl m} t          |           |dvrt          d|           |j        t          j        | |                    S )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@   s       r   r{   r{   ?  rA   r   c                  ddl m} t          |           |dvrt          d|           |j        t          j        | j        |                    S )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_liker0   rE   s       r   r}   r}   R  rF   r   )
r   r   r   r   r   r   r   r   r    r
   )Nr	   )r5   r6   r7   r8   r9   r8   r   r   r   r   r    r
   )r<   r=   r   r   r   r   r    r
   )rB   r
   r   r   r   r   r    r
   r   )rH   r1   rI   rJ   rG   r1   r   r   r   r   r    r
   )rB   rN   r    r
   )
r<   r=   rQ   r8   r   r   r   r   r    r
   )
rQ   r8   rB   r
   r   r   r   r   r    r
   )rY   r1   r9   r8   r5   r8   r   r   r   r   rX   rZ   r    r
   )r_   r
   r^   r`   r    ra   )rB   r
   rG   r1   r    r
   )%
__future__r   typingr   r   r   r   r   _typingr
   r   r   r   r   collections.abcr   _dtypesr   numpyr(   r   r3   r;   r?   rD   rM   rP   rT   rW   r\   rm   ro   rq   ru   ry   r{   r}   rd   r   r   <module>r      sX   " " " " " " ? > > > > > > > > > > > > > )              )(((((                B B B, "#04) ) ) ) ) )^ )-	K "#K K K K K K2 "#	4 4 4 4 4 4( .2d< < < < < <$ !B
 !#B B B B B B,) ) ) ) "#     @ "#     @ "#U U U U U U. .2      . "#	3 3 3 3 3 3( .2d; ; ; ; ; ;  #$ . . . . . . #$ . . . . . ." "#	4 4 4 4 4 4( .2d< < < < < < < <r   