
    `i                     `    d dl 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l	m
Z
 d
dZd	 ZdS )    N)_core)_fusion_interface)fusion)search)runtime	same_kindc           	         d}t          |          }|t          t          t          t          fv r7t          j        d| j                  }t          j        |||           d}d}n|t          j
        t          j        fv r%|j        }t          j        || j        |          }d}nt          |t
          j                  st          j        |          rS|j        dk    rt%          d          |j        }t          j        || j        |          }|                                }d}n"|j        }t          j        || j        |          }|st)          d|d	| j        d
|d          t          j                    r<|t-          j        ||            n"t          j        t2          j        ||| |            dS |st7          d t9          j        t=          |j                  t=          | j                  d          D                       st%          d|j         d| j                   |j         | j         z
  }	|	dk    r/|!                    tE          tG          |	                              }|t-          j        || |           dS | j        dk    rdS |rt-          j        ||            dS tI          | |          r'| j%        &                    |j%        |j'                   dS | j(        }
tS          j*                    }	 tS          j+        |
j,                   |j(        |
k    r|-                                }t-          j        ||            tS          j+        |           dS # tS          j+        |           w xY w)a  Copies values from one array to another with broadcasting.

    This function can be called for arrays on different devices. In this case,
    casting, ``where``, and broadcasting is not supported, and an exception is
    raised if these are used.

    Args:
        dst (cupy.ndarray): Target array.
        src (cupy.ndarray): Source array.
        casting (str): Casting rule. See :func:`numpy.can_cast` for detail.
        where (cupy.ndarray of bool): If specified, this array acts as a mask,
            and an element is copied only if the corresponding element of
            ``where`` is True.

    .. seealso:: :func:`numpy.copyto`

    F )dtype)castingT   z2non-scalar numpy.ndarray cannot be used for copytozCannot cast z to z in z casting modeNc                      g | ]\  }}||d fv S )r   r
   ).0sds      l/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/_manipulation/basic.py
<listcomp>zcopyto.<locals>.<listcomp>L   s4     
 
 
1 !QK
 
 
    )	fillvaluez+could not broadcast input array from shape z into shape r   )_where).typeboolintfloatcomplexnumpyemptyr   copytor   _FusionVarScalarr   _ScalarProxycan_cast
isinstancendarrayisscalarsize
ValueErroritem	TypeError
_is_fusingr   elementwise_copy_call_ufuncr   _where_ufuncall	itertoolszip_longestreversedshapendimsqueezetuplerange_can_memcpydatacopy_from_asyncnbytesdevicer   	getDevice	setDeviceidcopy)dstsrcr   wheresrc_is_scalarsrc_typedst_arrr!   	src_dtypesqueeze_ndimr:   prev_devices               r   r   r      s   $ MCyyHD#ug...+b	222 	Wc73333	f-/@/MN	N	NI	>)SY@@	C	'	' 
A5>#+>+> 
A8q==DF F FI	>#sy'::hhjjI	>)SY@@ 9i"CIIIwww8 9 9 	9  	
 ="3,,,,v2E3SIII :
  
 
!-##Xci%8%8AG G G
 
 
   	B
 A!iA A58YA AB B B x#(*!++eE,$7$78899CsC6666
x1}} sC(((3   3:666ZF#%%K'&)$$$:((**CsC(((+&&&&&+&&&&s    AM# #M9c                     | j         j        o|j         j        }| j         j        o|j         j        }|s|o| j        |j        k    o| j        |j        k    S )N)flagsc_contiguousf_contiguousr   r%   )r?   r@   rJ   rK   s       r   r6   r6   s   sX    9)Dci.DL9)Dci.DL(L ci39.D CHr   )r   N)r.   r   cupyr   
cupy._corer   r   cupy._sortingr   cupy_backends.cuda.apir   r   r6   r
   r   r   <module>rP      s               ( ( ( ( ( (                   * * * * * *d' d' d' d'N    r   