
     TiS                        S SK Jr  S SKJrJrJrJrJr  S SKJ	r	  S SK
Jr  S SKJr  S SKJr  S SKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r   S SK!J"r"J#r#   " S	 S
\5      r$g)    )annotations)OptionalSequenceTupleTypeVarUnion)
GraphProto)
get_schema)	TypeAlias)Opset16)BFLOAT16BOOL	COMPLEX64
COMPLEX128DOUBLEFLOATFLOAT16INT8INT16INT32INT64STRINGUINT8UINT16UINT32UINT64)OpOpsetc                  j   \ rS rSr% S r\" S\\5      r\	\
\\\\\\\\\\\4   rS\S'   SSS.       S(S jjr\" S	\
\\\5      r\" S
\\5      r S)SSSS.           S*S jjjr\" S\\5      r\	\
\\\\\\\\\\\4   rS\S'   SSS.       S+S jjr\" S\\5      r\	\
\\\\\\\\\\\4   rS\S'   SSS.       S,S jjr\" S\
\\\5      r \	\
\4   r!S\S'    S)SSSS.             S-S jjjr"\" S\\5      r#\" S\
\\\5      r$\	\
\\\\\\\\\\\4   r%S\S'   SS.             S.S jjr&\" S \
\\\5      r'\" S!\\5      r(  S/SS".           S0S# jjjr)\" S$\*\+   \*\,   \*\-   \*\   \*\   \*\   \*\   \*\   \*\   \*\   \*\.   \*\   \*\   \*\   \*\   5      r/\" / S%P\*\+   P\*\,   P\*\-   P\*\   P\*\   P\*\   P\*\   P\*\   P\*\   P\*\   P\*\.   P\*\   P\*\   P\*\   P\*\   P\+P\,P\-P\P\P\P\P\P\P\P\.P\P\P\P\P76 r0        S1S& jr1S'r2g)2Opset17+   c                2    [         R                  " U SS5      $ )N    )r   __new__)clss    b/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnxscript/onnx_opset/_impl/opset17.pyr%   Opset17.__new__,   s    }}S"b))    T1_BlackmanWindowr   T2_BlackmanWindow   output_datatypeperiodicc               f    [        SSS5      n[        U SU5      nU" U R                  XA5      UUS.6$ )u  [🌐 BlackmanWindow(17)](https://onnx.ai/onnx/operators/onnx__BlackmanWindow.html#blackmanwindow-17 "Online Documentation")


Generates a Blackman window as described in the paper https://ieeexplore.ieee.org/document/1455106.


Args:
    size: (non-differentiable) A scalar value indicating the length of the
        window.

    output_datatype: The data type of the output tensor. Strictly must be one of
        the values from DataType enum in TensorProto whose values correspond to
        T2. The default value is 1 = FLOAT.

    periodic: If 1, returns a window to be used as periodic function. If 0,
        return a symmetric window. When 'periodic' is specified, hann computes a
        window of length size + 1 and returns the first size points. The default
        value is 1.
BlackmanWindowr$   r#   r-   r
   r   _prepare_inputsselfsizer.   r/   schemaops         r'   r1   Opset17.BlackmanWindow@   sC    . ,b"5&/!!&/+
 	
r)   T1_DFTT2_DFTNr   axisinverseonesidedc               j    [        SSS5      n[        U SU5      nU" U R                  XaU5      UUUS.6$ )u  [🌐 DFT(17)](https://onnx.ai/onnx/operators/onnx__DFT.html#dft-17 "Online Documentation")

Computes the discrete Fourier transform of input.

Args:
    input: (non-differentiable) For real input, the following shape is expected:
        [batch_idx][signal_dim1][signal_dim2]...[signal_dimN][1]. For complex
        input, the following shape is expected:
        [batch_idx][signal_dim1][signal_dim2]...[signal_dimN][2]. The first
        dimension is the batch dimension. The following N dimensions correspond
        to the signal's dimensions. The final dimension represents the real and
        imaginary parts of the value in that order.

    dft_length: (optional, non-differentiable) The length of the signal as a
        scalar. If greater than the axis dimension, the signal will be
        zero-padded up to dft_length. If less than the axis dimension, only the
        first dft_length values will be used as the signal. It's an optional
        value.

    axis: The axis on which to perform the DFT. By default this value is set to
        1, which corresponds to the first dimension after the batch index.
        Negative value means counting dimensions from the back. Accepted range
        is $[-r, -2] \cup [0, r-2]$ where `r = rank(input)`. The last dimension
        is for representing complex numbers and thus is an invalid axis.

    inverse: Whether to perform the inverse discrete fourier transform. By
        default this value is set to 0, which corresponds to false.

    onesided: If onesided is 1, only values for w in [0, 1, 2, ...,
        floor(n_fft/2) + 1] are returned because the real-to-complex Fourier
        transform satisfies the conjugate symmetry, i.e., X[m, w] = X[m,
        n_fft-w]*. Note if the input or window tensors are complex, then
        onesided output is not possible. Enabling onesided with real inputs
        performs a Real-valued fast Fourier transform (RFFT). When invoked with
        real or complex valued input, the default value is 0. Values can be 0 or
        1.
DFTr$   r#   r<   r2   )r5   input
dft_lengthr=   r>   r?   r7   r8   s           r'   rA   Opset17.DFTc   sG    ^ E2r*eV$!!&<	
 	
r)   T1_HammingWindowT2_HammingWindowc               f    [        SSS5      n[        U SU5      nU" U R                  XA5      UUS.6$ )u  [🌐 HammingWindow(17)](https://onnx.ai/onnx/operators/onnx__HammingWindow.html#hammingwindow-17 "Online Documentation")


Generates a Hamming window as described in the paper https://ieeexplore.ieee.org/document/1455106.


Args:
    size: (non-differentiable) A scalar value indicating the length of the
        window.

    output_datatype: The data type of the output tensor. Strictly must be one of
        the values from DataType enum in TensorProto whose values correspond to
        T2. The default value is 1 = FLOAT.

    periodic: If 1, returns a window to be used as periodic function. If 0,
        return a symmetric window. When 'periodic' is specified, hann computes a
        window of length size + 1 and returns the first size points. The default
        value is 1.
HammingWindowr$   r#   r-   r2   r4   s         r'   rH   Opset17.HammingWindow   sA    . OR4ov.!!&/+
 	
r)   T1_HannWindowT2_HannWindowc               f    [        SSS5      n[        U SU5      nU" U R                  XA5      UUS.6$ )u  [🌐 HannWindow(17)](https://onnx.ai/onnx/operators/onnx__HannWindow.html#hannwindow-17 "Online Documentation")


Generates a Hann window as described in the paper https://ieeexplore.ieee.org/document/1455106.


Args:
    size: (non-differentiable) A scalar value indicating the length of the
        window.

    output_datatype: The data type of the output tensor. Strictly must be one of
        the values from DataType enum in TensorProto whose values correspond to
        T2. The default value is 1 = FLOAT.

    periodic: If 1, returns a window to be used as periodic function. If 0,
        return a symmetric window. When 'periodic' is specified, hann computes a
        window of length size + 1 and returns the first size points. The default
        value is 1.

HannWindowr$   r#   r-   r2   r4   s         r'   rM   Opset17.HannWindow   sA    . L"b1lF+!!&/+
 	
r)   T_LayerNormalizationU_LayerNormalizationg   >r=   epsilon
stash_typec               j    [        SSS5      n[        U SU5      nU" U R                  XqX#5      UUUS.6$ )u
  [🌐 LayerNormalization(17)](https://onnx.ai/onnx/operators/onnx__LayerNormalization.html#layernormalization-17 "Online Documentation")


      This is layer normalization defined in ONNX as function.
      The overall computation can be split into two stages.
      The first stage is standardization, which makes the
      normalized elements have zero mean and unit variances.
      The computation required by standardization can be
      described by the following equations.
      ```
      Mean = ReduceMean<axes=normalized_axes>(X)
      D = Sub(X, Mean)
      DD = Mul(D, D)
      Var = ReduceMean<axes=normalized_axes>(DD)
      VarEps = Add(Var, epsilon)
      StdDev = Sqrt(VarEps)
      InvStdDev = Reciprocal(StdDev)
      Normalized = Mul(D, InvStdDev)
      ```
      where `normalized_axes` is `[axis, ..., rank of X - 1]`.
      The variables `Var` and `StdDev` stand for variance and
      standard deviation, respectively. The second output is
      `Mean` and the last one is `InvStdDev`.
      Depending on `stash_type` attribute, the actual computation
      must happen in different floating-point precision.
      For example, if `stash_type` is 1, this operator casts
      all input variables to 32-bit float, perform the computation, and
      finally cast `Normalized` back to the original type of `X`.
      The second stage then scales and shifts the outcome of the
      first stage using
      ```
      NormalizedScaled = Mul(Normalized, Scale)
      Y = Add(NormalizedScaled, B)
      ```
      The second stage doesn't depends on `stash_type`.
      All equations are in [this syntax](https://github.com/onnx/onnx/blob/main/docs/Syntax.md).
      The same variable (i.e., input, output, and attribute) uses
      the same name in the equations above and this operator's definition.
      Let `d[i]` indicate the i-th dimension of `X`.
      If `X`'s shape is `[d[0], ..., d[axis-1], d[axis], ..., d[rank-1]]`,
      the shape of `Mean` and `InvStdDev` is `[d[0], ..., d[axis-1], 1, ..., 1]`.
      `Y` and `X` have the same shape. This operator supports unidirectional broadcasting
      (tensors `Scale` and `B` should be unidirectional broadcastable to tensor `X`);
      for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


Args:
    X: Tensor to be normalized.

    Scale: Scale tensor.

    B: (optional) Bias tensor.

    axis: The first normalization dimension. If rank(X) is r, axis' allowed
        range is [-r, r). Negative value means counting dimensions from the
        back.

    epsilon: The epsilon value to use to avoid division by zero.

    stash_type: Type of Mean and InvStdDev. This also specifies stage one's
        computation precision.
LayerNormalizationr$   r#   rR   r2   )	r5   XScaleBr=   rS   rT   r7   r8   s	            r'   rV   Opset17.LayerNormalization   sI    R 0"b9*F3!!&U6!	
 	
r)   T1_MelWeightMatrixT2_MelWeightMatrixT3_MelWeightMatrix)r.   c          
     n    [        SSS5      n[        U SU5      nU" U R                  UUUUUU5      SU06$ )u  [🌐 MelWeightMatrix(17)](https://onnx.ai/onnx/operators/onnx__MelWeightMatrix.html#melweightmatrix-17 "Online Documentation")


Generate a MelWeightMatrix that can be used to re-weight a Tensor containing a linearly sampled frequency spectra (from DFT or STFT) into num_mel_bins frequency information based on the [lower_edge_hertz, upper_edge_hertz] range on the mel scale.
This function defines the mel scale in terms of a frequency in hertz according to the following formula:

    mel(f) = 2595 * log10(1 + f/700)

In the returned matrix, all the triangles (filterbanks) have a peak value of 1.0.

The returned MelWeightMatrix can be used to right-multiply a spectrogram S of shape [frames, num_spectrogram_bins] of linear scale spectrum values (e.g. STFT magnitudes) to generate a "mel spectrogram" M of shape [frames, num_mel_bins].


Args:
    num_mel_bins: (non-differentiable) The number of bands in the mel spectrum.

    dft_length: (non-differentiable) The size of the original DFT. The size of
        the original DFT is used to infer the size of the onesided DFT, which is
        understood to be floor(dft_length/2) + 1, i.e. the spectrogram only
        contains the nonredundant DFT bins.

    sample_rate: (non-differentiable) Samples per second of the input signal
        used to create the spectrogram. Used to figure out the frequencies
        corresponding to each spectrogram bin, which dictates how they are
        mapped into the mel scale.

    lower_edge_hertz: (non-differentiable) Lower bound on the frequencies to be
        included in the mel spectrum. This corresponds to the lower edge of the
        lowest triangular band.

    upper_edge_hertz: (non-differentiable) The desired top edge of the highest
        frequency band.

    output_datatype: The data type of the output tensor. Strictly must be one of
        the values from DataType enum in TensorProto whose values correspond to
        T3. The default value is 1 = FLOAT.
MelWeightMatrixr$   r#   r.   r2   )	r5   num_mel_binsrC   sample_ratelower_edge_hertzupper_edge_hertzr.   r7   r8   s	            r'   r_   Opset17.MelWeightMatrixd  sZ    ` -r26'0!!  

 ,

 
	
r)   T1_STFTT2_STFT)r?   c          	     h    [        SSS5      n[        U SU5      nU" U R                  XaX#U5      SU06$ )u;  [🌐 STFT(17)](https://onnx.ai/onnx/operators/onnx__STFT.html#stft-17 "Online Documentation")

Computes the Short-time Fourier Transform of the signal.

Args:
    signal: (non-differentiable) Input tensor representing a real or complex
        valued signal. For real input, the following shape is expected:
        [batch_size][signal_length][1]. For complex input, the following shape
        is expected: [batch_size][signal_length][2], where
        [batch_size][signal_length][0] represents the real component and
        [batch_size][signal_length][1] represents the imaginary component of the
        signal.

    frame_step: (non-differentiable) The number of samples to step between
        successive DFTs.

    window: (optional, non-differentiable) A tensor representing the window that
        will be slid over the signal.The window must have rank 1 with shape:
        [window_shape]. It's an optional value.

    frame_length: (optional, non-differentiable) A scalar representing the size
        of the DFT. It's an optional value.

    onesided: If onesided is 1, only values for w in [0, 1, 2, ...,
        floor(n_fft/2) + 1] are returned because the real-to-complex Fourier
        transform satisfies the conjugate symmetry, i.e., X[m, w] =
        X[m,w]=X[m,n_fft-w]*. Note if the input or window tensors are complex,
        then onesided output is not possible. Enabling onesided with real inputs
        performs a Real-valued fast Fourier transform (RFFT).When invoked with
        real or complex valued input, the default value is 1. Values can be 0 or
        1.
STFTr$   r#   r?   r2   )r5   signal
frame_stepwindowframe_lengthr?   r7   r8   s           r'   rh   Opset17.STFT  sH    T FB+ff%!!&*lS

 	
r)   S_SequenceMapV_SequenceMapc               h    [        SSS5      n[        U SU5      nU" U R                  " XA/UQ76 SU06$ )u  [🌐 SequenceMap(17)](https://onnx.ai/onnx/operators/onnx__SequenceMap.html#sequencemap-17 "Online Documentation")


Applies a sub-graph to each sample in the input sequence(s).

Inputs can be either tensors or sequences, with the exception of the first input which must
be a sequence. The length of the first input sequence will determine the number of samples in the
outputs. Any other sequence inputs should have the same number of samples. The number of inputs
and outputs, should match the one of the subgraph.

For each i-th element in the output, a sample will be extracted from the input sequence(s) at
the i-th position and the sub-graph will be applied to it.
The outputs will contain the outputs of the sub-graph for each sample, in the same order as in
the input.

This operator assumes that processing each sample is independent and could executed in parallel
or in any order. Users cannot expect any specific ordering in which each subgraph is computed.

Args:
    input_sequence: Input sequence.

    additional_inputs: (variadic, heterogeneous) Additional inputs to the graph

    body: The graph to be run for each sample in the sequence(s). It should have
        as many inputs and outputs as inputs and outputs to the SequenceMap
        function.
SequenceMapr$   r#   bodyr2   )r5   input_sequencerr   additional_inputsr7   r8   s         r'   rq   Opset17.SequenceMap  sC    D M2r2mV,4''SARS_Z^__r)    )r6   r*   r.   intr/   rw   returnr+   )N)rB   r:   rC   zOptional[T2_DFT]r=   rw   r>   rw   r?   rw   rx   r:   )r6   rE   r.   rw   r/   rw   rx   rF   )r6   rJ   r.   rw   r/   rw   rx   rK   )rW   rO   rX   rO   rY   zOptional[T_LayerNormalization]r=   rw   rS   floatrT   rw   rx   zGTuple[T_LayerNormalization, U_LayerNormalization, U_LayerNormalization])r`   r[   rC   r[   ra   r[   rb   r\   rc   r\   r.   rw   rx   r]   )NN)ri   re   rj   rf   rk   zOptional[T1_STFT]rl   zOptional[T2_STFT]r?   rw   rx   re   )rs   rn   rt   ro   rr   r	   rx   rn   )3__name__
__module____qualname____firstlineno__r%   r   r   r   r*   r   r   r   r   r   r   r   r   r   r   r   r+   __annotations__r1   r:   r;   rA   rE   rF   rH   rJ   rK   rM   rO   rP   rV   r[   r\   r]   r_   re   rf   rh   r   r   r   r   r   rn   ro   rq   __static_attributes__rv   r)   r'   r    r    +   s   *   3UEB#(	$y   BCTU
%
;>
NQ
	
> Xx@FXue,F
 (,6

 6
6
 %6

 6
 6
 6
 
6
p 15%@"'	#i   ABST
$
:=
MP
	
> OUE:M$	 M9   >?PQ
!
7:
JM
	
> ##98VUT[\&+HeO&<)< -1	P
 .P
P
 $P
 *	P
 P
 P
 P
 
QP
d !!5ueD !5xPWX$)	%	 .  !<
(<
 '<
 (	<

 -<
 -<
 <
 
<
| i65'BGi.G %)*./
 /
/
 /
 "	/

 (/
 /
 
/
b !M&      	  		 
 	  	  	  	  	  	  	  	  	  	  	   	! " 	# $ 	% & 	' ( 	) * 	+ , 	- . 	/ 0 	1 2 	3 4 	5 6 	7 8 	9 : 	; < 	= > 	? MD$`%$` *$` 	$`
 
$`r)   r    N)%
__future__r   typingr   r   r   r   r   onnxr	   	onnx.defsr
   typing_extensionsr   #onnxscript.onnx_opset._impl.opset16r   onnxscript.onnx_typesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   onnxscript.valuesr   r   r    rv   r)   r'   <module>r      sJ    # < <    ' 7    $ (E`g E`r)   