o
    i                     @   s   d dl Z dddZdS )    Nc                 C   s2   t j| |dd}t | | }|t j||dd S )a  Softmax function.

    The softmax function transforms each element of a
    collection by computing the exponential of each element
    divided by the sum of the exponentials of all the elements.

    Parameters
    ----------
    x : array-like
        The input array
    axis : int or tuple of ints, optional
        Axis to compute values along. Default is None

    Returns
    -------
    s : cupy.ndarray
        Returns an array with same shape as input. The result
        will sum to 1 along the provided axis

    T)axiskeepdims)cupyamaxexpsum)xr   x_maxexp_x_shifted r   Y/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/cupyx/scipy/special/_softmax.pysoftmax   s   r   )N)r   r   r   r   r   r   <module>   s    