
    JThg                        S r SSKrSSKJr  SSKJr  SSKrSSKJr  SSKJ	r	J
r
Jr  SSKJrJr  / SQr\R                   " \R"                  S	S
9r\" S5      \R&                  " SSSSSS5      S\R(                  S\R*                  S\\   S\R*                  S\R*                  S\S\4S j5       5       r\" S5      S\R(                  4S j5       rS r\" S5      \R&                  " SSSSSSSSS5	             S(S\R(                  S\R*                  S\S\\   S \\   S!\\R*                     S"\S#\\   S$\\   S%\\   S&\R*                  4S' jj5       5       rg))a  This file exports ONNX ops for opset 17.

Note [ONNX Operators that are added/updated in opset 17]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-17-of-the-default-onnx-operator-set
New operators:
    BlackmanWindow
    DFT
    HammingWindow
    HannWindow
    LayerNormalization
    MelWeightMatrix
    STFT
    SequenceMap
    N)Sequence)Optional)_C)_type_utilserrorssymbolic_helper)	jit_utilsregistration)
layer_normstftquantized_layer_norm   )opsetzaten::layer_normvisfnoneginputnormalized_shapeweightbiasepscudnn_enablec           	         [        U5      * n[        R                  R                  U[        R                  R                  5      nUR                  5       n	[        R                  " U5      (       a$  [        R                  " X)S9n
U R                  SU
S9n[        R                  " U5      (       a$  [        R                  " X)S9nU R                  SUS9nU R                  SUUUUUS9$ )NdtypeConstantvalue_tLayerNormalization)	epsilon_faxis_i)lenr   JitScalarType
from_valueFLOATr   r   _is_nonetorchonesopzeros)r   r   r   r   r   r   r   axisscalar_typer   weight_value
bias_values               S/var/www/auris/envauris/lib/python3.13/site-packages/torch/onnx/symbolic_opset17.pyr   r   &   s      !!D++66{((..K E''zz"2@j,7%%[[!1?
ttJ
t344       zquantized::layer_normc           	          [         R                  " X5      u  n    n[        XX#XES5      n	[         R                  " X	Xg5      $ )NF)r   dequantize_helperr   quantize_helper)
r   xr   r   r   r   op_scaleop_zero_point_outputs
             r1   r   r   J   s@     !2218JAq!Q.5IF**1hNNr2   c                 $    X-
  S-  nX-
  U-
  nX#4$ )zqHelper function to compute the sizes of the edges (left and right)
of a given window centered within an FFT size.    )n_fftwindow_sizeleftrights       r1   _compute_edge_sizesrB   \   s%     A%DL;&E;r2   z
aten::stftibr>   
hop_length
win_lengthwindow
normalizedonesidedreturn_complexalign_to_windowreturnc
                    U(       a  [         R                  " SUS9eU	b  [         R                  " SUS9eUb  UOUS-  n
U R                  S[        R                  " U
[        R
                  S9S9nU R                  S[        R                  " U[        R
                  S9S9nUn[        R                  " U5      nUS:X  aD  U R                  S	UU R                  S[        R                  " S
/[        R
                  S9S95      nO"Ub  US:  a  [         R                  " SU S3US9e[        R                  " US
S9nUb  U(       a  UOUnUU:X  d   SU S345       eX:  ai  [        X/5      u  nnU R                  S[        R                  " U5      S9nU R                  S[        R                  " U5      S9nU R                  SUUUS
S9n[        R                  " U5      (       a  U(       a  XB:  a  [         R                  " SU SU S3US9e[        X$5      u  nn[        R                  " [        R                  " U5      [        R                  " U5      [        R                  " U5      45      nO[        R                  " U5      nUR                  S
   U:X  d   eU R                  SUS9nU R                  SU[        R                   R#                  U5      R%                  5       S9nU R                  SUUUUUb  U(       a  SOS
S9nU R                  SU/ SQS9nUS:X  aC  U R                  SUU R                  S[        R                  " S
/[        R
                  S9S95      nU(       ae  [        R&                  " [        R                  " X-R)                  5       R+                  5       S95      nU R                  SUU R                  SUS95      nU$ )af  Associates `torch.stft` with the `STFT` ONNX operator.
Note that torch.stft calls _VF.stft, without centering or padding options.
Hence, this function does not contain these two arguments.
See torch.stft source code for more info.

Args:
    g: Graph to write the ONNX representation into
    input: Input tensor for the transformation
    n_fft: FFT size
    hop_length: Size of the hop. Defaults to `floot(n_fft // 4)`
    win_length: Size of the analysis window. Defaults to `n_fft`
    window: Analysis window. Defaults to a window of all ones
    normalized: Whether to return a normalized STFT
    onesided: Whether to return only half (+1) of the results, given the
        symmetry of the STFT
    return_complex: Whether to return the complex value (Note: Must be
        `False` or `None`)

Returns:
    op: Operator for torch.stft associated with STFT (ONNX)
z-STFT does not currently support complex types)msgvaluez:STFT does not currently support the align_to_window option   r   r   r      	Unsqueezer   r<   zcSTFT can only take inputs of 1 [signal] or 2 [batch, signal] dimensions. Current rank of signal is z, please reduce it.)dimzuAnalysis window size must equal `win_length` or `n_fft`. Please, set `win_length` or `n_fft` to match `window` size ()Concat)r#   zWThe analysis window can't be longer than the size of the FFT. Please set `win_length` (z) to `n_fft` (z
) or less.Cast)to_iSTFT)
onesided_i	Transpose)r   r<   rQ      )perm_iSqueezeDiv)r   SymbolicValueErrorr+   r)   tensorint64r   _get_tensor_rank_get_tensor_dim_sizerB   r,   r(   hstackr*   shaper   r%   r&   	onnx_typesqrttyper   )r   r   r>   rE   rF   rG   rH   rI   rJ   rK   frame_step_valueframe_step_constframe_length_constsignalsignal_rankn_winwin_length_defaultr@   rA   left_win	right_wintorch_windowresult	sqrt_nffts                           r1   r   r   d   s   H ''?u
 	
 "''L
 	
 &0%;z!ttELL)9M   ELLekkB  
 F!226:KaDDU\\1#U[[%IDJ

 
	a''))45HJ
 	
 00Q?E+5Z5** 	
KKP'QRT-
 	
* =-e;KD%ttJD0AtBHZU1CDITT(HfiTJF ''!//00:|>%PZ\  .e@KD% <<T"EJJz$:EKK<NOL
 !::e,L!!!$---j,7TT[66AA&ISSU  F
 TT (H1!  F TT+vlT;F aDDU\\1#U[[%IDJ
 JJu||E9L9L9NOP	eVQTT*iT%HIMr2   )NNNFTFN)__doc__	functoolscollections.abcr   typingr   r)   r   
torch.onnxr   r   r   torch.onnx._internalr	   r
   __all__partialonnx_symbolic_onnx_symbolic
parse_argsGraphContextValueintfloatboolr   r   rB   r   r=   r2   r1   <module>r      s  "  $    ; ; 8 9""<#=#=RH "#CsCf=88 sm HH	
 (( 
  > $D '(OO )O" Cc3S#sCH
 !% $!%#%*&*II88I I 	I
 I RXXI I tnI TNI d^I XXI I Ir2   