
    `i                     F    d dl Z d dl mZ ddZe j        fdZddZddZdS )	    N)_corec                     t          j        | ||          } t          j        |                                           st	          d          | S )a  Converts the given input to an array,
    and raises an error if the input contains NaNs or Infs.

    Args:
        a: array like.
        dtype: data type, optional
        order: {'C', 'F', 'A', 'K'}, optional

    Returns:
        cupy.ndarray: An array on the current device.

    .. note::
        This function performs device synchronization.

    .. seealso:: :func:`numpy.asarray_chkfinite`

    )dtypeorderz#array must not contain Infs or NaNs)cupyasarrayisfiniteall
ValueError)ar   r   s      k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/_manipulation/kind.pyasarray_chkfiniter      sM    & 	Qe5111A=!! @>???H    c                     t          j        |t           j                  st           j        }t          j        | |          S )a  Converts array elements to float type.

    Args:
        a (cupy.ndarray): Source array.
        dtype: str or dtype object, optional

    Returns:
        cupy.ndarray: The input array ``a`` as a float ndarray.

    .. seealso:: :func:`numpy.asfarray`

    r   )r   
issubdtypeinexactfloat64r   r   r   s     r   asfarrayr      s6     ?5$,// <''''r   c                 ,    t          j        | |          S )am  Return an array laid out in Fortran order in memory.

    Args:
        a (~cupy.ndarray): The input array.
        dtype (str or dtype object, optional): By default, the data-type is
            inferred from the input data.

    Returns:
        ~cupy.ndarray: The input `a` in Fortran, or column-major, order.

    .. seealso:: :func:`numpy.asfortranarray`

    )r   asfortranarrayr   s     r   r   r   0   s     5)))r   c           
         ddddddddd|sG	 t          j        | |          S # t          $ r# t          d                    |                    w xY w	 fd|D             }nq# t
          $ rd t          d                    t          |          t                                                    z
                                                      w xY wd	}|ddhk    rt          d
          d|v rd}|	                    d           nd|v rd}|	                    d           d|v }	 t          j
        | |||d          }n0# t          $ r# t          d                    |                    w xY w|S )a  Return an array which satisfies the requirements.

    Args:
        a (~cupy.ndarray): The input array.
        dtype (str or dtype object, optional): The required data-type.
            If None preserve the current dtype.
        requirements (str or list of str): The requirements can be any
            of the following

            * 'F_CONTIGUOUS' ('F', 'FORTRAN') - ensure a Fortran-contiguous                 array. 
            * 'C_CONTIGUOUS' ('C', 'CONTIGUOUS') - ensure a C-contiguous array.

            * 'OWNDATA' ('O')      - ensure an array that owns its own data.

    Returns:
        ~cupy.ndarray: The input array ``a`` with specified requirements and
        type if provided.

    .. seealso:: :func:`numpy.require`

    CFOWNDATA)r   C_CONTIGUOUS
CONTIGUOUSr   F_CONTIGUOUSFORTRANOr   r   zIncorrect dtype "{}" providedc                 D    h | ]}|                                          S  )upper).0xpossible_flagss     r   	<setcomp>zrequire.<locals>.<setcomp>e   s&    LLL!N177995LLLr   z#Incorrect flag "{}" in requirementsAz%Cannot specify both "C" and "F" orderr   r   F)r   r   copysubok)r   
asanyarray	TypeErrorr   formatKeyErrorsetkeyspopremovearray)r   r   requirementsr   r*   arrr'   s         @r   requirer7   A   s   2 3$< <N  B	N?1E2222 	N 	N 	N>EEeLLMMM	N	BLLLL|LLLLL 	B 	B 	BDKK!,//!."5"5"7"7889:=#%%A A B B B	B
 ESz!!@AAA			C    			C   $DJj%u4uMMM J J J:AA%HHIIIJJs"   & -AA& &A.C,E -E3)NN)N)r   r   r   r   r   r   r7   r#   r   r   <module>r8      s             2 l ( ( ( ($* * * *"9 9 9 9 9 9r   