
    `i                         d dl Z d dl mZ d dlmc mZ d d d d d d d	Zd
 Zd Zd Zd Z	ej
        Z
d Zd Zd ZddZdS )    N)_corec                     dS N)    shapes    k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/_manipulation/dims.py<lambda>r   	   s    $     c                     dS )N)r   r   r   r   s    r
   r   r   
   s    & r   c                     d| z   S r   r   r   s    r
   r   r      s
    $, r   c                     dS )N)r   r   r   r   r   s    r
   r   r      s    ) r   c                     d| z   dz   S r   r   r   s    r
   r   r      s    $,- r   c                     | dz   S r   r   r   s    r
   r   r      s
    %$, r   ))r   r   )   r   )r   r   )   r   )r   r   )r   r   c                     g }|D ]a}t          j        |          }|j        | k     r+t          | |j        f         |j                  } |j        | }|                    |           bt          |          dk    r|\  }|S )z)Helper function for atleast_nd functions.r   )cupyasarrayndim_atleast_nd_shape_mapr	   reshapeappendlen)narysresa	new_shapes        r
   _atleast_nd_helperr!      s     C  LOO6A::-q!&k:17CCI	9%A

1
3xx1}}Jr   c                  "    t          d|           S )a  Converts arrays to arrays with dimensions >= 1.

    Args:
        arys (tuple of arrays): Arrays to be converted. All arguments must be
            :class:`cupy.ndarray` objects. Only zero-dimensional array is
            affected.

    Returns:
        If there are only one input, then it returns its converted version.
        Otherwise, it returns a list of converted arrays.

    .. seealso:: :func:`numpy.atleast_1d`

    r   r!   r   s    r
   
atleast_1dr%   "   s     a&&&r   c                  "    t          d|           S )a  Converts arrays to arrays with dimensions >= 2.

    If an input array has dimensions less than two, then this function inserts
    new axes at the head of dimensions to make it have two dimensions.

    Args:
        arys (tuple of arrays): Arrays to be converted. All arguments must be
            :class:`cupy.ndarray` objects.

    Returns:
        If there are only one input, then it returns its converted version.
        Otherwise, it returns a list of converted arrays.

    .. seealso:: :func:`numpy.atleast_2d`

    r   r#   r$   s    r
   
atleast_2dr'   4   s    " a&&&r   c                  "    t          d|           S )a?  Converts arrays to arrays with dimensions >= 3.

    If an input array has dimensions less than three, then this function
    inserts new axes to make it have three dimensions. The place of the new
    axes are following:

    - If its shape is ``()``, then the shape of output is ``(1, 1, 1)``.
    - If its shape is ``(N,)``, then the shape of output is ``(1, N, 1)``.
    - If its shape is ``(M, N)``, then the shape of output is ``(M, N, 1)``.
    - Otherwise, the output is the input array itself.

    Args:
        arys (tuple of arrays): Arrays to be converted. All arguments must be
            :class:`cupy.ndarray` objects.

    Returns:
        If there are only one input, then it returns its converted version.
        Otherwise, it returns a list of converted arrays.

    .. seealso:: :func:`numpy.atleast_3d`

    r   r#   r$   s    r
   
atleast_3dr)   H   s    . a&&&r   c                  8    t          t          |  j                  S )zBroadcasts given arrays.

    Args:
        args (tuple of arrays): Arrays to broadcast for each other.

    Returns:
        list: A list of broadcasted arrays.

    .. seealso:: :func:`numpy.broadcast_arrays`

    )list	broadcastvalues)argss    r
   broadcast_arraysr/   e   s     	4 '(((r   c                 ,    t          j        | |          S )a  Broadcast an array to a given shape.

    Args:
        array (cupy.ndarray): Array to broadcast.
        shape (tuple of int): The shape of the desired array.

    Returns:
        cupy.ndarray: Broadcasted view.

    .. seealso:: :func:`numpy.broadcast_to`

    )r   broadcast_to)arrayr	   s     r
   r1   r1   t   s     eU+++r   c                 l    t          |          t          t          fvr|f}t          j        | |          S )a3  Expands given arrays.

    Args:
        a (cupy.ndarray): Array to be expanded.
        axis (int): Position where new axis is to be inserted.

    Returns:
        cupy.ndarray: The number of dimensions is one greater than that of
        the input array.

    .. seealso:: :func:`numpy.expand_dims`

    )typetupler+   _manipulation_expand_dimsr   axiss     r
   expand_dimsr:      s3     Dzz%&&u%a...r   c                 ,    |                      |          S )a  Removes size-one axes from the shape of an array.

    Args:
        a (cupy.ndarray): Array to be reshaped.
        axis (int or tuple of ints): Axes to be removed. This function removes
            all size-one axes by default. If one of the specified axes is not
            of size one, an exception is raised.

    Returns:
        cupy.ndarray: An array without (specified) size-one axes.

    .. seealso:: :func:`numpy.squeeze`

    )squeezer8   s     r
   r<   r<      s      99T??r   )N)r   r   !cupy._core._routines_manipulation_routines_manipulationr6   r   r!   r%   r'   r)   r,   r/   r1   r:   r<   r   r   r
   <module>r?      s           9 9 9 9 9 9 9 9 9   &&##--&&     ' ' '$' ' '(' ' '4 O	) ) ), , , / / /&     r   