
    x-j@                     D    d dl Zd dlZd dlmZmZ d dlmZ d Zd Z	d Z
dS )    N)check_dtypeconvert_dtype)Variablec                    | dg} nt          | t          t          j        t          j        f          r| g} nt          | t
          t          j        j        f          rUd| _	        t          | j        dddgdd|z   d	z              t          | j                  dk    rt          j        | d          } nt          |           g} | S )
z]
    Convert out_size(int, np.int32, np.int64, Variable) to list
    in imperative mode.
    Nr   Tout_sizeint32int64op_type(When type of out_size in is Variable.))
isinstanceintnpr   r	   r   paddlepirValuestop_gradientr   dtyper   cast)r   r
   s     f/var/www/html/banglarbhumi/venv/lib/python3.11/site-packages/paddle/geometric/message_passing/utils.pyconvert_out_size_to_listr      s    
 3	HsBHbh7	8	8 #:	Hx)9:	;	; #!%Ng''14DD	
 	
 	
 ((G33{8W55HMM?O    c                 |   |dg|d<   dS t          |t          t          j        t          j        f          r|g|d<   dS t          |t
                    r[d|_        t          |j        dddgdd|z   d	z              t          |j                  dk    rt          j        |d          }|| d
<   dS t          d          )zk
    Convert out_size(int, np.int32, np.int64, Variable) to inputs
    and attrs in static graph mode.
    Nr   r   Tr   r	   r
   r   r   Out_sizez'Out_size only supports Variable or int.)r   r   r   r   r	   r   r   r   r   r   r   r   	TypeError)inputsattrsr   r
   s       r   get_out_size_tensor_inputsr   /   s    
 Cj	HsBHbh7	8	8 C%Jj	Hh	'	' C!%Ng''14DD	
 	
 	
 ((G33{8W55H%zABBBr   c                 "   t          | j                  dk    rt          j        | ddg          } t          |j                  dk    rt          j        |ddg          }t          j        |           }t          j        |          }t          | j                  t          |j                  k    rt	          t          | j                  t          |j                            }|t          | j                  z
  }|t          |j                  z
  }|d         gdg|z  z   t          |dd                   z   }|d         gdg|z  z   t          |dd                   z   }t          j        | |          } t          j        ||          }| |fS )zm
    Expand dims to ensure there will be no broadcasting issues with different
    number of dimensions.
       r   N)lenshaper   reshapemaxlist)	xyx_shapey_shape	max_ndimsx_pad_ndimsy_pad_ndimsnew_x_shapenew_y_shapes	            r   reshape_lhs_rhsr0   H   s   
 17||qN1r1g&&
17||qN1r1g&&l1ooGl1ooG
17||s17||##AGc!'ll33	#ag,,.#ag,,. 
   7122;  	 
   7122;  	 N1k**N1k**a4Kr   )numpyr   r   paddle.base.data_feederr   r   paddle.base.frameworkr   r   r   r0    r   r   <module>r5      s         > > > > > > > > * * * * * *  2C C C2' ' ' ' 'r   