o
    i                     @   s*   d dl Z d dl mZ dd ZdddZdS )    N)_corec                 C   sp  zt |}W n ty   |f}Y nw t|}|dt|kr.t| tjr.tj| d|dS tj| d|d}||jk rDd|j|  | }t dd t	|j
|D }|jdkr^tj||jd	S g }g }t	|j
|D ]6\}}	|	dkr{|| || qh|dkr|| ||	 qh|d || ||	 || qhtj||jd	}
|
jrt|||
 |
|S )
a   Construct an array by repeating A the number of times given by reps.

    Args:
        A (cupy.ndarray): Array to transform.
        reps (int or tuple): The number of repeats.

    Returns:
        cupy.ndarray: Transformed array with repeats.

    .. seealso:: :func:`numpy.tile`

       T)copyndminF)r   c                 s   s    | ]	\}}|| V  qd S N ).0str   r   V/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/cupy/_manipulation/tiling.py	<genexpr>!   s    ztile.<locals>.<genexpr>r   )dtype)tuple	TypeErrorlencount
isinstancecupyndarrayarrayndimzipshapesizeemptyr   appendr   elementwise_copyreshape)Arepstupdc	shape_outc_shape	ret_shapedim_innrepretr   r   r   tile   s>   








r)   c                 C   s   |  ||S )a+  Repeat arrays along an axis.

    Args:
        a (cupy.ndarray): Array to transform.
        repeats (int, list or tuple): The number of repeats.
        axis (int): The axis to repeat.

    Returns:
        cupy.ndarray: Transformed array with repeats.

    .. seealso:: :func:`numpy.repeat`

    )repeat)arepeatsaxisr   r   r   r*   8   s   r*   r   )r   r   r)   r*   r   r   r   r   <module>   s    3