o
    W۷i	                     @  s   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 dddZdd	d
ZdddZeddddZdd ZedddZedddZedddZedddZdS )     )annotationsN)_core)fusion)ufunc)	bf16_loopc                 C  s:   t  rt jtjj| ||dS tj| dd} | j||dS )a  Rounds to the given number of decimals.

    Args:
        a (cupy.ndarray): The source array.
        decimals (int): Number of decimal places to round to (default: 0).
            If decimals is negative, it specifies the number of positions to
            the left of the decimal point.
        out (cupy.ndarray): Output array.

    Returns:
        cupy.ndarray: Rounded array.

    .. seealso:: :func:`numpy.around`

    outF)copy)r   
_is_fusing_call_ufuncr   core_round_ufuncarrayroundadecimalsr    r   I/home/ubuntu/vllm_env/lib/python3.10/site-packages/cupy/_math/rounding.pyaround   s   r   c                 C  s   t | ||dS )Nr   )r   r   r   r   r   r   "   s   r   c                 C  s   t dt t| ||dS )NzPlease use `round` instead.r   )warningswarnDeprecationWarningr   r   r   r   r   round_&   s   r   rint   	cupy_rintzbRounds each element of an array to the nearest integer.

    .. seealso:: :data:`numpy.rint`

    c                 C  sJ   t j| ddddddddd	d
dd|fgt|dd|fd|fR d|dS )Nz?->?zb->bzB->Bzh->hzH->Hzi->izI->Izl->lzL->Lzq->qzQ->Qze->e)codezf->fzd->dz
out0 = in0)doc)r   create_ufuncr   )nameopr   r   r   r   create_rounding_ufunc4   s0   r"   
cupy_floorzout0 = floor(in0)zaRounds each element of an array to its floor integer.

    .. seealso:: :data:`numpy.floor`

    	cupy_ceilzout0 = ceil(in0)zbRounds each element of an array to its ceiling integer.

    .. seealso:: :data:`numpy.ceil`

    
cupy_trunczout0 = trunc(in0)zYRounds each element of an array towards zero.

    .. seealso:: :data:`numpy.trunc`

    cupy_fixz+out0 = (in0 >= 0.0) ? floor(in0): ceil(in0)zxIf given value x is positive, it return floor(x).
    Else, it return ceil(x).

    .. seealso:: :func:`numpy.fix`

    )r   N)
__future__r   r   cupyr   
cupy._corer   
cupy._mathr   
cupy._utilr   r   r   r   create_math_ufuncr   r"   floorceiltruncfixr   r   r   r   <module>   sD    


	