| Files | Last commit | Last update |
|---|---|---|
| 8 days ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 9 days ago | ||
| 1 month ago | ||
| 9 days ago | ||
| 10 months ago | ||
| 1 month ago | ||
| 9 days ago |
Stft
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | × |
| Atlas training products | × |
Function Description
-
Operator function: computes the Fourier transform of the input within a sliding window.
-
Computation formula:
-
When normalized=false:
X[w,m]=∑k=0winLength−1window[k]∗self[m∗hopLength+k]∗exp(−j∗2πwknFft)X[w,m]=\sum_{k=0}^{winLength-1}window[k]*self[m*hopLength+k]*exp(-j*\frac{2{\pi}wk}{nFft})
-
When normalized=true:
X[w,m]=1nFft(∑k=0winLength−1window[k]∗self[m∗hopLength+k]∗exp(−j∗2πwknFft))X[w,m]=\frac{1}{\sqrt{nFft}}(\sum_{k=0}^{winLength-1}window[k]*self[m*hopLength+k]*exp(-j*\frac{2{\pi}wk}{nFft}))
Here:
- ww is the frequency point of the FFT.
- mm is the index of the sliding window.
- selfself is a 1D or 2D Tensor. If selfself is 1D, it is a time-series sampling sequence. If selfself is 2D, it is multiple time-series sampling sequences.
- hopLengthhopLength is the sliding window size.
- windowwindow is a 1D Tensor and the window function of the STFT (for example, hann_window), whose length is winLengthwinLength.
- exp(−j∗2πwknFft)exp(-j*\frac{2{\pi}wk}{nFft}) is the twiddle factor.
-
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input to be computed, corresponding to `self` in the formula. It must be a 1D/2D Tensor with the shape [L]/[B, L], where L is the length of the time-series sampling sequence and B is the number of time-series sampling sequences. Inputs Inf, -Inf, and NaN are not supported. | FLOAT32, DOUBLE, COMPLEX64, COMPLEX128 | ND |
| window | Optional input | It must be a 1D Tensor, corresponding to `window` in the formula. The shape is [winLength], where winLength is the length of the STFT window function, and the data type is the same as that of `x`. | FLOAT32, DOUBLE, COMPLEX64, COMPLEX128 | ND |
| hop_length | Optional attribute |
|
INT64 | - |
| win_length | Optional attribute |
|
INT64 | - |
| normalized | Optional attribute |
|
BOOL | - |
| onesided | Optional attribute |
|
BOOL | - |
| return_complex | Optional attribute |
|
BOOL | - |
| n_fft | Attribute | Number of FFT points (greater than 0), corresponding to `nFft` in the formula. | INT64 | - |
| y | Output | Result of the Fourier transform of `x` within `window`. It must be a 2D/3D/4D Tensor, corresponding to `X[w,m]` in the formula. If return_complex=True, y is a complex Tensor with the shape [N, T] or [B, N, T]. If return_complex=False, y is a real Tensor with the shape [N, T, 2] or [B, N, T, 2]. Here, N=n_fft(onesided=False) or (n_fft // 2 + 1)(onesided=True); T is the number of sliding windows, T = (L - n_fft) // hop_length + 1. | FLOAT32, DOUBLE, COMPLEX64, COMPLEX128 | ND |
Constraint Description
- n_fft <= L.
- win_length <= n_fft.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| aclnn API | test_aclnn_stft | Invokes the Stft operator through the aclStft API. |
| Graph mode | - | Invokes the Stft operator by building a graph through the operator IR. |