o
    X۷i                  	   @  s<   d dl mZ d dlZejjddddddd	d
Zddd	ZdS )    )annotationsNzT x1zT yzexp(x1)za + bz
y = log(a)0log_softmax)namec                 C  s   t j| |dd}|jdkrd|t | < nt |sd}| | }|jjdv r@t jt jt jfD ]}t 	|j|r?|
|} nq/t||dd}|| }|S )a  Compute logarithm of softmax function

    Parameters
    ----------
    x : array-like
        Input array
    axis : int or tuple of ints, optional
        Axis to compute values along. Default is None and softmax
        will be  computed over the entire array `x`

    Returns
    -------
    s : cupy.ndarry
        An array with the same shape as `x`. Exponential of the
        result will sum to 1 along the specified axis. If `x` is a
        scalar, a scalar is returned

    T)axiskeepdimsr   iu)cpamaxndimisfinitedtypekindfloat16float32float64can_castastype_log_softmax_kernel)xr   x_maxtmp	out_dtypeout r   U/home/ubuntu/vllm_env/lib/python3.10/site-packages/cupyx/scipy/special/_logsoftmax.pyr      s   


)N)
__future__r   cupyr	   _coreReductionKernelr   r   r   r   r   r   <module>   s    