
    yjgc                    r   d dl mZ d dlZd dlZd dlmZ d dlZd dlZerd dlm	Z	 d dl
mZ ddlmZ d dlmZmZmZmZ  G d	 d
          Z e            Ze                                dTd            Ze                                dUdVd            Ze                                	 dUdWd            Ze                                dUdVd            Ze                                dXd            Ze                                dYd             Ze                                dZd!            Ze                                d[d$            Ze                                	 dUdVd%            Ze                                	 dUd\d(            Ze                                	 dUd]d*            Z e                                	 d^dVd-            Z!e                                dUdVd.            Z"e                                dUdVd/            Z#e                                	 d_dVd1            Z$e                                	 dUd`d3            Z%e                                	 dadVd5            Z&e                                dUdVd6            Z'e                                dUdVd7            Z(e                                dUdVd8            Z)e                                dUdVd9            Z*	 	 dUdbd>Z+ddd?d?d@dcdGZ,	 	 	 dddJddd?d?dKdedNZ-	 dfdJddd?d?dKdgdOZ.	 	 dhdJddd?d?dKdidQZ/	 dfdJddd?d?dKdgdRZ0	 dfdJddd?d?dKdgdSZ1dS )j    )annotationsN)TYPE_CHECKING)Tensor)	PlaceLike   )_WindowLiteral)_current_expected_place_get_paddle_placecorein_dynamic_or_pir_modec                  "    e Zd Zd ZddZd ZdS )WindowFunctionRegisterc                    i | _         d S N_functions_dict)selfs    n/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/paddle/audio/functional/window.py__init__zWindowFunctionRegister.__init__&   s    !    Nc                      fd}|S )Nc                *    | j         }| j        |<   | S r   )__name__r   )funcnamer   s     r   add_subfunctionz8WindowFunctionRegister.register.<locals>.add_subfunction*   s    =D)-D &Kr    )r   r   r   s   `  r   registerzWindowFunctionRegister.register)   s$    	 	 	 	 	
 r   c                    | j         |         S r   r   )r   r   s     r   getzWindowFunctionRegister.get1   s    #D))r   r   )r   
__module____qualname__r   r   r    r   r   r   r   r   %   sF        " " "   * * * * *r   r   xlist[Tensor]	data_typestrreturnr   c                .   g }| D ]}}t          j        |          r?t          |t                    s*|                    t          j        |g|                     U|                    t          j        ||                     ~t          j        |          S r   )npisscalar
isinstancer&   appendpaddle	to_tensorconcat)r#   r%   lts       r   _catr2   8   s    
A 5 5;q>> 	5*Q"4"4 	5HHV%qc9556666HHV%a334444=r   Tfloat64Mintsymbooldtypec                v   t          |           rt          j        | f|          S t          | |          \  } }t          j        d| |          }t          j        | |          } t          j        t          j        || dz
  dz            d|z  | dz
  z  dd|z  | dz
  z  z
            }t          ||          S )zm
    Computes the Bartlett window.
    This function is consistent with scipy.signal.windows.bartlett().
    r8   r             @)	_len_guardsr-   ones_extendaranger.   where
less_equal	_truncater4   r6   r8   needs_truncnws         r   	_bartlettrH   C   s     1~~ .{A4u----Q__NA{a%(((A%(((A!a!es]++a1q5cAgQ	 	A Q$$$r   betafloatc                   t          |           rt          j        | f|          S t          | |          \  } }t          j        ||          }t          j        d| |          }t          j        | |          } | dz
  dz  }t          j        |t          j        d||z
  |z  dz  z
            z            t          j        |          z  }t          ||          S )zcCompute the Kaiser window.
    This function is consistent with scipy.signal.windows.kaiser().
    r:   r   r;   r<   )	r=   r-   r>   r?   r.   r@   i0sqrtrC   )r4   rI   r6   r8   rE   rF   alpharG   s           r   _kaiserrO   X   s     1~~ .{A4u----Q__NA{D...Da%(((A%(((AUcME	v{1Ue 3;;<<<	 		$	A Q$$$r   c                X    t          j        g d|          }t          | |||          S )zYNuttall window.
    This function is consistent with scipy.signal.windows.nuttall().
    )gzD?g;%N?g1|?gC ˅?r:   )ar6   r8   )r-   r.   _general_cosine)r4   r6   r8   rQ   s       r   _nuttallrS   o   s?    
 	444E	 	 	A 1s%8888r   Tensor | floatc                   t          | t                    r/t          j        | t          j        | dz  dz
            z             S t          j        | t          j        t          j        |           dz
            z             S )Nr   r;   )r+   rJ   mathlogrM   r-   square)r#   s    r   _acoshrY   z   si    !U 1xDIadQh///000:a&+fmA&6&6&:;;;<<<r   c                    |s| dz   dfS | dfS )z:Extend window by 1 sample if needed for DFT-even symmetry.r;   TFr   )r4   r6   s     r   r?   r?      s#      1ud{%xr   c                ^    t          |           | k    s| dk     rt          d          | dk    S )z)Handle small or incorrect window lengths.r   z.Window length M must be a non-negative integerr;   )r5   
ValueError)r4   s    r   r=   r=      s3     1vv{{a!eeIJJJ6Mr   rG   neededc                    |r
| dd         S | S )z<Truncate window by 1 sample if needed for DFT-even symmetry.Nr   )rG   r]   s     r   rC   rC      s      "vr   c                8   t          |           rt          j        | f|          S t          | |          \  } }t          j        d| |          | dz
  dz  z
  }t          j        dt          j        ||z            d|z  z  z            }t          ||          S )zCompute a window with a generalized Gaussian shape.
    This function is consistent with scipy.signal.windows.general_gaussian().
    r:   r         ?r<   g      r   )r=   r-   r>   r?   r@   expabsrC   )r4   psigr6   r8   rE   rF   rG   s           r   _general_gaussianrf      s     1~~ .{A4u----Q__NA{a%(((AGs?:A
4&*QW--!a%8899AQ$$$r   rQ   list[float]c                   t          |           rt          j        | f|          S t          | |          \  } }t          j        t
          j         t
          j        | |          }t          j        | f|          }t          t          |                    D ]%}|||         t          j
        ||z            z  z  }&t          ||          S )zCompute a generic weighted sum of cosine terms window.
    This function is consistent with scipy.signal.windows.general_cosine().
    r:   )r=   r-   r>   r?   linspacerV   pizerosrangelencosrC   )r4   rQ   r6   r8   rE   facrG   ks           r   rR   rR      s     1~~ .{A4u----Q__NA{
/47(DGQe
<
<
<CaT'''A3q66]] ( (	QqTFJq3w''''Q$$$r   rN   c                2    t          | |d|z
  g||          S )zvCompute a generalized Hamming window.
    This function is consistent with scipy.signal.windows.general_hamming()
    ra   r:   rR   )r4   rN   r6   r8   s       r   _general_hammingrs      s$     1ucEk2CuEEEEr         c           	         t                     rt          j         f|          S t           |          \   }d|dz  z  }t	          |          t
          j        z  }|dz  |dz  |dz
  dz  z   z  }	t          j        d||          t          j        |dz
  f|          t          j	                  }
d|
ddd<   d|
ddd<   z  }t          t                              D ]}|
|         t          j        d||         |	z  |dz  dz
  dz  z   z  z
            z  }|d	k    r/dt          j        d||         ||dz   d         z  z
            z  }n|t                    dz
  k    r,dt          j        d||         |d|         z  z
            z  }nWdt          j        d||         |d|         z  z
            z  t          j        d||         ||dz   d         z  z
            z  }||z  |<    fd
} |t          j        d	 |                    }|rd | dz
  dz            z  }||z  }|                                }t          ||          S )zCompute a Taylor window.
    The Taylor window taper function approximates the Dolph-Chebyshev window's
    constant sidelobe level for a parameterized number of near-in sidelobes.
    r:   
      r         ?r;   Nr_   r   c                    ddt          j                            d          t          j        dt          j        z                      d          z  | dz  z
  dz   z  z                      z  z   S )Nr;   r   r   r<   ry   )r-   matmul	unsqueezern   rV   rj   )rF   Fmr4   mas    r   Wz_taylor.<locals>.W   sk    1v}LLOOJq47{R\\!__4AGc8IJQNOO
 
 
 
 	
r   ra   )r=   r-   r>   r?   rY   rV   rj   r@   empty
empty_likerl   rm   prodsqueezerC   )r4   nbarsllnormr6   r8   rE   BAs2signsm2minumberdenomr   rG   scaler}   r~   s   `                 @@r   _taylorr      s    1~~ .{A4u----Q__NA{ 	sRxAq		DGA	qAqDD3J1,,	-B	q$e	,	,	,B	taxk	/	/	/Bb!!EE##A#JE!$Q$K	bBCGGnn    rV[2q!trCxAo566
 
 
 77A2BFHH(=$=>>>EE3r77Q;A2CRC(8$8999EE +a"R&2crc7"22334+a"R&2b1fhh<"77889  %2
 
 
 
 
 
 
 	
&-1E
*
*
*++A  aaQ!nn$	U
			AQ$$$r   c                (    t          | d||          S )zCompute a Hamming window.
    The Hamming window is a taper formed by using a raised cosine with
    non-zero endpoints, optimized to minimize the nearest side lobe.
    HzG?r:   rs   r4   r6   r8   s      r   _hammingr     s     AtS6666r   c                (    t          | d||          S )zCompute a Hann window.
    The Hann window is a taper formed by using a raised cosine or sine-squared
    with ends that touch zero.
    ry   r:   r   r   s      r   _hannr   
  s     AsCu5555r   ry   c           	        t          |           rt          j        | f|          S |dk    rt          j        | f|          S |dk    rt          | |          S t	          | |          \  } }t          j        d| |          }t          || dz
  z  dz            }|d|dz            }||dz   | |z
  dz
           }|| |z
  dz
  d         }	ddt          j        t          j	        d	d|z  |z  | dz
  z  z   z            z   z  }
t          j        |j
        |          }ddt          j        t          j	        d
|z  dz   d|	z  |z  | dz
  z  z   z            z   z  }t          j        |
||g          }t          ||          S )z[Compute a Tukey window.
    The Tukey window is also known as a tapered cosine window.
    r:   r   ra   )r6   r;   r<   Nry   r_   g       )r=   r-   r>   r   r?   r@   r5   rn   rV   rj   shaper/   rC   )r4   rN   r6   r8   rE   rF   widthn1n2n3w1w2w3rG   s                 r   _tukeyr     s    1~~ .{A4u----zz{A4u----	#QC    Q__NA{a%(((AQ#%&&E	
1uqy=	B	
519q5y1}$	%B	
1u9q=??	B	FJtw"sRx%/?1q5/I*IJKKK	LB	RXU	+	+	+B		
*TWuq 038e3Cq1u3M MN
O
O	P
B 	r2rl##AQ$$$r   stdc                   t          |           rt          j        | f|          S t          | |          \  } }t          j        d| |          | dz
  dz  z
  }d|z  |z  }t          j        |dz   |z            }t          ||          S )ztCompute a Gaussian window.
    The Gaussian widows has a Gaussian shape defined by the standard deviation(std).
    r:   r   ra   r<   r   )r=   r-   r>   r?   r@   rb   rC   )r4   r   r6   r8   rE   rF   sig2rG   s           r   	_gaussianr   5  s     1~~ .{A4u----Q__NA{a%(((AGs?:As7S=D
QT7T>""AQ$$$r   ra   c                V   |r|t          d          t          |           rt          j        | f|          S t	          | |          \  } }|| dz
  dz  }t          j        d| |          }t          j        t          j        ||z
             |z            }t          ||          S )z+Compute an exponential (or Poisson) window.Nz"If sym==True, center must be None.r:   r;   r   r   )	r\   r=   r-   r>   r?   r@   rb   rc   rC   )r4   centertaur6   r8   rE   rF   rG   s           r   _exponentialr   G  s    
  ?v!=>>>1~~ .{A4u----Q__NA{~a%1a%(((A
FJq6z***S011AQ$$$r   c                   t          |           rt          j        | f|          S t          | |          \  } }t          j        d| dz   dz  dz   |          }| dz  dk    r+d|z  dz
  | z  }t          j        ||ddd         g          }n*d|z  | dz   z  }t          j        ||ddd         g          }t          ||          S )	zCompute a triangular window.r:   r;   r   r   ra   Nr_   )r=   r-   r>   r?   r@   r/   rC   rD   s         r   _triangr   [  s     1~~ .{A4u----Q__NA{a!a%A)777A1uzzUS[AM1a"g,''EQWM1aBi.))Q$$$r   c                   t          |           rt          j        | f|          S t          | |          \  } }t          j        t          j        dd| |          dd                   }d|z
  t          j        t          j        |z            z  dt          j        z  t          j	        t          j        |z            z  z   }t          d|dg|          }t          ||          S )z^Compute a Bohman window.
    The Bohman window is the autocorrelation of a cosine window.
    r:   r_   r;   ra   r   )r=   r-   r>   r?   rc   ri   rn   rV   rj   sinr2   rC   )r4   r6   r8   rE   ro   rG   s         r   _bohmanr   m  s    
 1~~ .{A4u----Q__NA{
*V_RAU;;;AbDA
B
BC	
SFJtw}---dg
#A A 1 	A 	aAYAQ$$$r   c                ,    t          | g d||          S )a  Compute a Blackman window.
    The Blackman window is a taper formed by using the first three terms of
    a summation of cosines. It was designed to have close to the minimal
    leakage possible.  It is close to optimal, only slightly worse than a
    Kaiser window.
    )gzG?ry   g{Gz?r:   rr   r   s      r   	_blackmanr     s"     1000#UCCCCr   c                   t          |           rt          j        | f|          S t          | |          \  } }t          j        t
          j        | z  t          j        d| |          dz   z            }t          ||          S )z,Compute a window with a simple cosine shape.r:   r   ry   )	r=   r-   r>   r?   r   rV   rj   r@   rC   )r4   r6   r8   rE   rG   s        r   _cosiner     sz     1~~ .{A4u----Q__NA{
47Q;&-1E"B"B"BS"HIJJAQ$$$r   window-_WindowLiteral | tuple[_WindowLiteral, float]
win_lengthfftbinsc                   | }d}t          | t                    r&| d         }t          |           dk    r
| dd         }nPt          | t                    r| dv rt	          d| z   dz             | }nt	          t          |            d          	 t                              d	|z             }n"# t          $ r}t	          d
          |d}~ww xY w|g|R }	d|i}
 ||	d|i|
S )a	  Return a window of a given length and type.

    Args:
        window (Union[str, Tuple[str, float]]): The window function applied to the signal before the Fourier transform. Supported window functions: 'hamming', 'hann', 'gaussian', 'general_gaussian', 'exponential', 'triang', 'bohman', 'blackman', 'cosine', 'tukey', 'taylor', 'bartlett', 'kaiser', 'nuttall'.
        win_length (int): Number of samples.
        fftbins (bool, optional): If True, create a "periodic" window. Otherwise, create a "symmetric" window, for use in filter design. Defaults to True.
        dtype (str, optional): The data type of the return window. Defaults to 'float64'.

    Returns:
        Tensor: The window represented as a tensor.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> n_fft = 512
            >>> cosine_window = paddle.audio.functional.get_window('cosine', n_fft)

            >>> std = 7
            >>> gaussian_window = paddle.audio.functional.get_window(('gaussian', std), n_fft)
    r   r   r;   N)gaussianexponentialkaiserzThe 'z6' window needs one or more parameters -- pass a tuple.z! as window type is not supported._zUnknown window type.r6   r8   )	r+   tuplerm   r&   r\   typewindow_function_registerr    KeyError)r   r   r   r8   r6   argswinstrwinfunceparamskwargss              r   
get_windowr     s3   8 +CD&%   Mv;;??!"":D	FC	 	  	M:::&  $3 3  
 FFDLLKKKLLL8*..sV|<< 8 8 8/00a78 4  FS\F7F2%26222s   B0 0
C:C

CFlayoutdevice
pin_memoryrequires_gradr   
str | Noner   PlaceLike | Noner   r   c               2   |t          j        d           t                      r'|t          |          nt	                      }|rt          j                    r|t          |t          j	        t          j
        f          st          |t          j                  s.t          |t          j                  r(|                                rt          j	                    }nnt          |t          j                  s.t          |t          j                  r(|                                rt          j
                    }nt!          d|           |                     |          } |r't          j                    r|                                 } |du rd| _        | S )Nz1layout only supports 'strided' in Paddle; ignoredz$Pinning memory is not supported for )r   TF)warningswarnr   r
   r	   r-   in_dynamic_moder+   r   CUDAPinnedPlaceXPUPinnedPlace	CUDAPlacePlaceis_gpu_placeXPUPlaceis_xpu_placeRuntimeErrortor   stop_gradient)rG   r   r   r   r   s        r   _apply_window_postprocessr     s    IJJJ  ! f%%%(** 	 	&((	 "-t/BC  #
 &$.11 64:..393F3F3H3H -//FDM22 64:..393F3F3H3H ,.."C6CC   	
FA f,.. LLNNHr   r   q=
ףp?float32)r8   r   r   r   r   window_lengthperiodicc                   t          d| ||          }	d\  }
}||z  }|||
z  z
  }|||	z  z   }t          |||||          S )u!  
    Compute a generalized Hamming window.

    Args:
        window_length (int): The size of the returned window. Must be positive.
        periodic (bool, optional): If True, returns a window for use as a periodic function; if False, returns a symmetric window. Defaults to True.
        alpha (float, optional): The coefficient α in the equation above. Defaults to 0.54.
        beta (float, optional): The coefficient β in the equation above. Defaults to 0.46.
        dtype (str, optional): The data type of the returned tensor. Defaults to 'float32'.
        layout (str, optional): Only included for API consistency with PyTorch; ignored in Paddle. Defaults to None.
        device(PlaceLike|None, optional): The desired device of returned tensor.
            if None, uses the current device for the default tensor type (see paddle.device.set_device()).
            device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
        pin_memory(bool, optional): If set, return tensor would be allocated in the pinned memory. Works only for CPU tensors. Default: False
        requires_grad(bool, optional):  If autograd should record operations on the returned tensor. Default: False.

    Returns:
        Tensor: A 1-D tensor of shape `(window_length,)` containing the Hamming window.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> win = paddle.hamming_window(400, requires_grad=True)
            >>> win = paddle.hamming_window(256, alpha=0.5, beta=0.5)
    hammingr   r8   )r   r   r   r   r   )r   r   rN   rI   r8   r   r   r   r   w0alpha0beta0r   r   rG   s                  r   hamming_windowr     sn    N 
I}he	L	L	LBMFEuAF
A	AF
A$	#   r   c               P    t          d| ||          }t          |||||          S )a;  
    Compute a Hann window.

    Args:
        window_length (int): The size of the returned window. Must be positive.
        periodic (bool, optional): If True, returns a window for use as a periodic function; if False, returns a symmetric window. Defaults to True.
        dtype (str, optional): The data type of the returned tensor. Defaults to 'float32'.
        layout (str, optional): Only included for API consistency with PyTorch; ignored in Paddle. Defaults to None.
        device(PlaceLike|None, optional): The desired device of returned tensor.
            if None, uses the current device for the default tensor type (see paddle.device.set_device()).
            device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
        pin_memory(bool, optional): If set, return tensor would be allocated in the pinned memory. Works only for CPU tensors. Default: False
        requires_grad(bool, optional):  If autograd should record operations on the returned tensor. Default: False.

    Returns:
        Tensor: A 1-D tensor of shape `(window_length,)` containing the Hann window.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> win = paddle.hann_window(512)
            >>> win = paddle.hann_window(512, requires_grad=True)
    hannr   r   r   r   r   r8   r   r   r   r   rG   s           r   hann_windowr   -  sA    F 	6=(%HHHA$	#   r         (@c               T    t          d|f| ||          }t          |||||          S )a  
    Compute a Kaiser window.

    Args:
        window_length (int): The size of the returned window. Must be positive.
        periodic (bool, optional): If True, returns a window for use as a periodic function; if False, returns a symmetric window. Defaults to True.
        beta (float, optional): Shape parameter for the window. Defaults to 12.0.
        dtype (str, optional): The data type of the returned tensor. Defaults to 'float32'.
        layout (str, optional): Only included for API consistency with PyTorch; ignored in Paddle. Defaults to None.
        device(PlaceLike|None, optional): The desired device of returned tensor.
            if None, uses the current device for the default tensor type (see paddle.device.set_device()).
            device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
        pin_memory(bool, optional): If set, return tensor would be allocated in the pinned memory. Works only for CPU tensors. Default: False
        requires_grad(bool, optional):  If autograd should record operations on the returned tensor. Default: False.

    Returns:
        Tensor: A 1-D tensor of shape `(window_length,)` containing the Kaiser window.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> win = paddle.kaiser_window(400, beta=8.6)
            >>> win = paddle.kaiser_window(400, requires_grad=True)
    r   r   r   r   )	r   r   rI   r8   r   r   r   r   rG   s	            r   kaiser_windowr   Z  sO    J 		4-	 	 	A %	#   r   c               P    t          d| ||          }t          |||||          S )aK  
    Compute a Blackman window.

    Args:
        window_length (int): The size of the returned window. Must be positive.
        periodic (bool, optional): If True, returns a window for use as a periodic function; if False, returns a symmetric window. Defaults to True.
        dtype (str, optional): The data type of the returned tensor. Defaults to 'float32'.
        layout (str, optional): Only included for API consistency with PyTorch; ignored in Paddle. Defaults to None.
        device(PlaceLike|None, optional): The desired device of returned tensor.
            if None, uses the current device for the default tensor type (see paddle.device.set_device()).
            device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
        pin_memory(bool, optional): If set, return tensor would be allocated in the pinned memory. Works only for CPU tensors. Default: False
        requires_grad(bool, optional):  If autograd should record operations on the returned tensor. Default: False.

    Returns:
        Tensor: A 1-D tensor of shape `(window_length,)` containing the Blackman window.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> win = paddle.blackman_window(256)
            >>> win = paddle.blackman_window(256, requires_grad=True)
    blackmanr   r   r   r   s           r   blackman_windowr     sA    F 	:}heLLLA$	#   r   c               P    t          d| ||          }t          |||||          S )al  
    Compute a Bartlett window.

    Args:
        window_length (int): The size of the returned window. Must be positive.
        periodic (bool, optional): If True, returns a window for use as a periodic function; if False, returns a symmetric window. Defaults to True.
        dtype (str, optional): The data type of the returned tensor. Defaults to 'float32'.
        layout (str, optional): Only included for API consistency with PyTorch; ignored in Paddle. Defaults to None.
        device(PlaceLike|None, optional): The desired device of returned tensor.
            if None, uses the current device for the default tensor type (see paddle.device.set_device()).
            device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
        pin_memory(bool, optional): If set, return tensor would be allocated in the pinned memory. Works only for CPU tensors. Default: False
        requires_grad(bool, optional):  If autograd should record operations on the returned tensor. Default: False.

    Returns:
        Tensor: A 1-D tensor of shape `(window_length,)` containing the Bartlett window.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> n_fft = 512
            >>> win = paddle.bartlett_window(n_fft)

            >>> win = paddle.bartlett_window(n_fft, requires_grad=True)
    bartlettr   r   r   r   s           r   bartlett_windowr     sA    J 	:}heLLLA$	#   r   )r#   r$   r%   r&   r'   r   )Tr3   )r4   r5   r6   r7   r8   r&   r'   r   )
r4   r5   rI   rJ   r6   r7   r8   r&   r'   r   )r#   rT   r'   r   )r4   r5   r6   r7   r'   r7   )r4   r5   r'   r7   )rG   r   r]   r7   r'   r   )
r4   r5   rQ   rg   r6   r7   r8   r&   r'   r   )
r4   r5   rN   rJ   r6   r7   r8   r&   r'   r   )rt   ru   TTr3   )ry   Tr3   )
r4   r5   r   rJ   r6   r7   r8   r&   r'   r   )Nra   Tr3   )
r   r   r   r5   r   r7   r8   r&   r'   r   )rG   r   r   r   r   r   r   r7   r   r7   r'   r   )Tr   r   )r   r5   r   r7   rN   rJ   rI   rJ   r8   r&   r   r   r   r   r   r7   r   r7   )T)r   r5   r   r7   r8   r&   r   r   r   r   r   r7   r   r7   )Tr   )r   r5   r   r7   rI   rJ   r8   r&   r   r   r   r   r   r7   r   r7   )2
__future__r   rV   r   typingr   numpyr)   r-   r   paddle._typingr   features.layersr   paddle.base.frameworkr	   r
   r   r   r   r   r   r2   rH   rO   rS   rY   r?   r=   rC   rf   rR   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s   # " " " " "                    1((((((000000           * * * * * * * *  2133  ""$$   %$ ""$$% % % % %$%( ""$$8A% % % % %$%, ""$$9 9 9 9 %$9 ""$$= = = %$= ""$$   %$ ""$$   %$ ""$$   %$ ""$$3<% % % % %$%  ""$$;D% % % % %$%  ""$$9BF F F F %$F ""$$FO5% 5% 5% 5% %$5%p ""$$7 7 7 7 %$7 ""$$6 6 6 6 %$6 ""$$6?% % % % %$%B ""$$7@% % % % %$%" ""$$AJ% % % % %$%& ""$$% % % % %$%" ""$$% % % % %$%" ""$$D D D D %$D ""$$% % % % %$% 	33 33 33 33 33r #* * * * * *^ 	2 #2 2 2 2 2 2n * #* * * * * *^ .
 #. . . . . .f * #* * * * * *^ , #, , , , , , , ,r   