Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
2022-06-05 10:58:58 +08:00
#
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
2022-06-05 10:58:58 +08:00
#
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
# http://www.apache.org/licenses/LICENSE-2.0
2022-06-05 10:58:58 +08:00
#
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2024-07-01 04:36:45 +08:00
from __future__ import annotations
from typing import TYPE_CHECKING , Literal
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
import paddle
2023-05-22 20:56:38 +08:00
from paddle import _C_ops
2024-08-14 11:12:23 +08:00
from paddle . framework import (
in_dynamic_mode ,
in_dynamic_or_pir_mode ,
in_pir_mode ,
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2023-09-07 17:26:19 +08:00
from . base . data_feeder import check_variable_and_dtype
from . base . layer_helper import LayerHelper
2022-11-29 18:50:04 +08:00
from . fft import fft_c2c , fft_c2r , fft_r2c
from . tensor . attribute import is_complex
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2024-07-01 04:36:45 +08:00
if TYPE_CHECKING :
from paddle import Tensor
_SignalAxes = Literal [ 0 , - 1 ]
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
__all__ = [
' stft ' ,
' istft ' ,
]
2024-07-01 04:36:45 +08:00
def frame (
x : Tensor ,
frame_length : int ,
hop_length : int ,
axis : _SignalAxes = - 1 ,
name : str | None = None ,
) - > Tensor :
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
"""
Slice the N-dimensional (where N >= 1) input into (overlapping) frames.
Args:
x (Tensor): The input data which is a N-dimensional (where N >= 1) Tensor
with shape `[..., seq_length]` or `[seq_length, ...]`.
frame_length (int): Length of the frame and `0 < frame_length <= x.shape[axis]`.
hop_length (int): Number of steps to advance between adjacent frames
2022-09-14 21:56:19 +08:00
and `0 < hop_length`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
axis (int, optional): Specify the axis to operate on the input Tensors. Its
value should be 0(the first dimension) or -1(the last dimension). If not
2022-09-14 21:56:19 +08:00
specified, the last axis is used by default.
2024-07-01 04:36:45 +08:00
name (str|None, optional): The default value is None. Normally there is no need for user
to set this property. For more information, please refer to :ref:`api_guide_Name`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Returns:
The output frames tensor with shape `[..., frame_length, num_frames]` if `axis==-1`,
otherwise `[num_frames, frame_length, ...]` where
2022-09-14 21:56:19 +08:00
2023-02-24 23:47:07 +08:00
`num_frames = 1 + (x.shape[axis] - frame_length) // hop_length`
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Examples:
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
.. code-block:: pycon
2023-08-30 10:37:35 +08:00
>>> import paddle
>>> from paddle import signal
>>> # 1D
>>> x = paddle.arange(8)
>>> y0 = signal.frame(x, frame_length=4, hop_length=2, axis=-1)
>>> print(y0)
Tensor(shape=[4, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
[[0, 2, 4],
[1, 3, 5],
[2, 4, 6],
[3, 5, 7]])
>>> y1 = signal.frame(x, frame_length=4, hop_length=2, axis=0)
>>> print(y1)
Tensor(shape=[3, 4], dtype=int64, place=Place(cpu), stop_gradient=True,
[[0, 1, 2, 3],
[2, 3, 4, 5],
[4, 5, 6, 7]])
>>> # 2D
>>> x0 = paddle.arange(16).reshape([2, 8])
>>> y0 = signal.frame(x0, frame_length=4, hop_length=2, axis=-1)
>>> print(y0)
Tensor(shape=[2, 4, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
[[[0 , 2 , 4 ],
[1 , 3 , 5 ],
[2 , 4 , 6 ],
[3 , 5 , 7 ]],
[[8 , 10, 12],
[9 , 11, 13],
[10, 12, 14],
[11, 13, 15]]])
>>> x1 = paddle.arange(16).reshape([8, 2])
>>> y1 = signal.frame(x1, frame_length=4, hop_length=2, axis=0)
>>> print(y1.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([3, 4, 2])
2023-08-30 10:37:35 +08:00
>>> # > 2D
>>> x0 = paddle.arange(32).reshape([2, 2, 8])
>>> y0 = signal.frame(x0, frame_length=4, hop_length=2, axis=-1)
>>> print(y0.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([2, 2, 4, 3])
2023-08-30 10:37:35 +08:00
>>> x1 = paddle.arange(32).reshape([8, 2, 2])
>>> y1 = signal.frame(x1, frame_length=4, hop_length=2, axis=0)
>>> print(y1.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([3, 4, 2, 2])
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
"""
if axis not in [ 0 , - 1 ] :
raise ValueError ( f ' Unexpected axis: { axis } . It should be 0 or -1. ' )
if not isinstance ( frame_length , int ) or frame_length < = 0 :
raise ValueError (
f ' Unexpected frame_length: { frame_length } . It should be an positive integer. '
)
if not isinstance ( hop_length , int ) or hop_length < = 0 :
raise ValueError (
f ' Unexpected hop_length: { hop_length } . It should be an positive integer. '
)
2023-05-22 20:56:38 +08:00
if in_dynamic_mode ( ) :
2022-03-23 13:18:59 +08:00
if frame_length > x . shape [ axis ] :
raise ValueError (
f ' Attribute frame_length should be less equal than sequence length, '
2022-10-23 20:01:27 +08:00
f ' but got ( { frame_length } ) > ( { x . shape [ axis ] } ). '
)
2022-08-26 16:11:47 +08:00
return _C_ops . frame ( x , frame_length , hop_length , axis )
2024-08-14 11:12:23 +08:00
elif in_pir_mode ( ) :
return _C_ops . frame ( x , frame_length , hop_length , axis )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
else :
2022-12-27 10:06:37 +08:00
op_type = ' frame '
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
check_variable_and_dtype (
2022-10-23 20:01:27 +08:00
x , ' x ' , [ ' int32 ' , ' int64 ' , ' float16 ' , ' float32 ' , ' float64 ' ] , op_type
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
helper = LayerHelper ( op_type , * * locals ( ) )
dtype = helper . input_dtype ( input_param_name = ' x ' )
out = helper . create_variable_for_type_inference ( dtype = dtype )
2022-10-23 20:01:27 +08:00
helper . append_op (
type = op_type ,
inputs = { ' X ' : x } ,
attrs = {
' frame_length ' : frame_length ,
' hop_length ' : hop_length ,
' axis ' : axis ,
} ,
outputs = { ' Out ' : out } ,
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
return out
2024-07-01 04:36:45 +08:00
def overlap_add (
x : Tensor , hop_length : int , axis : _SignalAxes = - 1 , name : str | None = None
) - > Tensor :
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
"""
Reconstructs a tensor consisted of overlap added sequences from input frames.
Args:
x (Tensor): The input data which is a N-dimensional (where N >= 2) Tensor
with shape `[..., frame_length, num_frames]` or
`[num_frames, frame_length ...]`.
hop_length (int): Number of steps to advance between adjacent frames and
2022-09-14 21:56:19 +08:00
`0 < hop_length <= frame_length`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
axis (int, optional): Specify the axis to operate on the input Tensors. Its
value should be 0(the first dimension) or -1(the last dimension). If not
2022-09-14 21:56:19 +08:00
specified, the last axis is used by default.
2024-07-01 04:36:45 +08:00
name (str|None, optional): The default value is None. Normally there is no need for user
to set this property. For more information, please refer to :ref:`api_guide_Name`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Returns:
The output frames tensor with shape `[..., seq_length]` if `axis==-1`,
otherwise `[seq_length, ...]` where
`seq_length = (n_frames - 1) * hop_length + frame_length`
Examples:
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
.. code-block:: pycon
2023-08-30 10:37:35 +08:00
>>> import paddle
>>> from paddle.signal import overlap_add
>>> # 2D
>>> x0 = paddle.arange(16).reshape([8, 2])
>>> print(x0)
Tensor(shape=[8, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
[[0 , 1 ],
[2 , 3 ],
[4 , 5 ],
[6 , 7 ],
[8 , 9 ],
[10, 11],
[12, 13],
[14, 15]])
>>> y0 = overlap_add(x0, hop_length=2, axis=-1)
>>> print(y0)
Tensor(shape=[10], dtype=int64, place=Place(cpu), stop_gradient=True,
[0 , 2 , 5 , 9 , 13, 17, 21, 25, 13, 15])
>>> x1 = paddle.arange(16).reshape([2, 8])
>>> print(x1)
Tensor(shape=[2, 8], dtype=int64, place=Place(cpu), stop_gradient=True,
[[0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ],
[8 , 9 , 10, 11, 12, 13, 14, 15]])
>>> y1 = overlap_add(x1, hop_length=2, axis=0)
>>> print(y1)
Tensor(shape=[10], dtype=int64, place=Place(cpu), stop_gradient=True,
[0 , 1 , 10, 12, 14, 16, 18, 20, 14, 15])
>>> # > 2D
>>> x0 = paddle.arange(32).reshape([2, 1, 8, 2])
>>> y0 = overlap_add(x0, hop_length=2, axis=-1)
>>> print(y0.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([2, 1, 10])
2023-08-30 10:37:35 +08:00
>>> x1 = paddle.arange(32).reshape([2, 8, 1, 2])
>>> y1 = overlap_add(x1, hop_length=2, axis=0)
>>> print(y1.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([10, 1, 2])
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
"""
if axis not in [ 0 , - 1 ] :
raise ValueError ( f ' Unexpected axis: { axis } . It should be 0 or -1. ' )
if not isinstance ( hop_length , int ) or hop_length < = 0 :
raise ValueError (
f ' Unexpected hop_length: { hop_length } . It should be an positive integer. '
)
op_type = ' overlap_add '
2024-08-14 11:12:23 +08:00
if in_dynamic_or_pir_mode ( ) :
2022-08-26 16:11:47 +08:00
out = _C_ops . overlap_add ( x , hop_length , axis )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
else :
check_variable_and_dtype (
2023-04-13 15:08:35 +08:00
x ,
' x ' ,
[ ' int32 ' , ' int64 ' , ' float16 ' , ' float32 ' , ' float64 ' , ' uint16 ' ] ,
op_type ,
2022-10-23 20:01:27 +08:00
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
helper = LayerHelper ( op_type , * * locals ( ) )
dtype = helper . input_dtype ( input_param_name = ' x ' )
out = helper . create_variable_for_type_inference ( dtype = dtype )
2022-10-23 20:01:27 +08:00
helper . append_op (
type = op_type ,
inputs = { ' X ' : x } ,
attrs = { ' hop_length ' : hop_length , ' axis ' : axis } ,
outputs = { ' Out ' : out } ,
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
return out
2022-10-23 20:01:27 +08:00
def stft (
2024-07-01 04:36:45 +08:00
x : Tensor ,
n_fft : int ,
hop_length : int | None = None ,
win_length : int | None = None ,
window : Tensor | None = None ,
center : bool = True ,
pad_mode : Literal [ " reflect " , " constant " ] = " reflect " ,
normalized : bool = False ,
2025-06-19 11:39:33 +08:00
onesided : bool | None = None ,
2024-07-01 04:36:45 +08:00
name : str | None = None ,
) - > Tensor :
2022-02-24 11:27:33 +08:00
r """
2022-11-22 17:31:52 +08:00
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Short-time Fourier transform (STFT).
The STFT computes the discrete Fourier transforms (DFT) of short overlapping
windows of the input using this formula:
2022-09-14 21:56:19 +08:00
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
.. math::
2022-12-15 10:57:42 +08:00
X_t[f] = \ sum_ { n = 0}^ { N-1} \ text {window} [n] \ x[t \ times H + n] \ e^ { - { 2 \ pi j f n}/ {N} }
2022-09-14 21:56:19 +08:00
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Where:
- :math:`t`: The :math:`t`-th input window.
2022-12-15 10:57:42 +08:00
- :math:`f`: Frequency :math:`0 \ leq f < \ text {n_fft} ` for `onesided=False`,
or :math:`0 \ leq f < \ lfloor \ text {n_fft} / 2 \ rfloor + 1` for `onesided=True`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
- :math:`N`: Value of `n_fft`.
2022-09-14 21:56:19 +08:00
- :math:`H`: Value of `hop_length`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Args:
x (Tensor): The input data which is a 1-dimensional or 2-dimensional Tensor with
shape `[..., seq_length]`. It can be a real-valued or a complex Tensor.
n_fft (int): The number of input samples to perform Fourier transform.
2024-07-01 04:36:45 +08:00
hop_length (int|None, optional): Number of steps to advance between adjacent windows
2022-12-15 10:57:42 +08:00
and `0 < hop_length`. Default: `None` (treated as equal to `n_fft//4`)
2024-07-01 04:36:45 +08:00
win_length (int|None, optional): The size of window. Default: `None` (treated as equal
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
to `n_fft`)
2024-07-01 04:36:45 +08:00
window (Tensor|None, optional): A 1-dimensional tensor of size `win_length`. It will
2022-12-15 10:57:42 +08:00
be center padded to length `n_fft` if `win_length < n_fft`. Default: `None` (
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
treated as a rectangle window with value equal to 1 of size `win_length`).
center (bool, optional): Whether to pad `x` to make that the
:math:`t \ times hop \ _length` at the center of :math:`t`-th frame. Default: `True`.
pad_mode (str, optional): Choose padding pattern when `center` is `True`. See
`paddle.nn.functional.pad` for all padding options. Default: ` " reflect " `
normalized (bool, optional): Control whether to scale the output by `1/sqrt(n_fft)`.
Default: `False`
onesided (bool, optional): Control whether to return half of the Fourier transform
output that satisfies the conjugate symmetry condition when input is a real-valued
2025-06-19 11:39:33 +08:00
tensor. It can not be `True` if input is a complex tensor. Default: `None`
2024-07-01 04:36:45 +08:00
name (str|None, optional): The default value is None. Normally there is no need for user
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
to set this property. For more information, please refer to :ref:`api_guide_Name`.
2022-09-14 21:56:19 +08:00
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Returns:
2022-11-22 17:31:52 +08:00
The complex STFT output tensor with shape `[..., n_fft//2 + 1, num_frames]`
(real-valued input and `onesided` is `True`) or `[..., n_fft, num_frames]`
(`onesided` is `False`)
2022-09-14 21:56:19 +08:00
2021-10-26 11:00:12 +08:00
Examples:
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
.. code-block:: pycon
2022-09-14 21:56:19 +08:00
2023-08-30 10:37:35 +08:00
>>> import paddle
>>> from paddle.signal import stft
>>> # real-valued input
>>> x = paddle.randn([8, 48000], dtype=paddle.float64)
>>> y1 = stft(x, n_fft=512)
>>> print(y1.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([8, 257, 376])
2023-08-30 10:37:35 +08:00
>>> y2 = stft(x, n_fft=512, onesided=False)
>>> print(y2.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([8, 512, 376])
2022-09-14 21:56:19 +08:00
2023-08-30 10:37:35 +08:00
>>> # complex input
>>> x = paddle.randn([8, 48000], dtype=paddle.float64) + \
... paddle.randn([8, 48000], dtype=paddle.float64)*1j
>>> print(x.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([8, 48000])
2023-08-30 10:37:35 +08:00
>>> print(x.dtype)
paddle.complex128
2022-09-14 21:56:19 +08:00
2023-08-30 10:37:35 +08:00
>>> y1 = stft(x, n_fft=512, center=False, onesided=False)
>>> print(y1.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([8, 512, 372])
2022-11-22 17:31:52 +08:00
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
"""
x_rank = len ( x . shape )
2022-10-23 20:01:27 +08:00
assert x_rank in [
1 ,
2 ,
] , f ' x should be a 1D or 2D real tensor, but got rank of x is { x_rank } '
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if x_rank == 1 : # (batch, seq_length)
x = x . unsqueeze ( 0 )
if hop_length is None :
hop_length = int ( n_fft / / 4 )
2022-10-23 20:01:27 +08:00
assert hop_length > 0 , f ' hop_length should be > 0, but got { hop_length } . '
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if win_length is None :
win_length = n_fft
2023-05-22 20:56:38 +08:00
if in_dynamic_mode ( ) :
2025-08-21 02:07:41 +08:00
assert 0 < n_fft < = x . shape [ - 1 ] , (
f ' n_fft should be in (0, seq_length( { x . shape [ - 1 ] } )], but got { n_fft } . '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2025-08-21 02:07:41 +08:00
assert 0 < win_length < = n_fft , (
f ' win_length should be in (0, n_fft( { n_fft } )], but got { win_length } . '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if window is not None :
2025-08-21 02:07:41 +08:00
assert len ( window . shape ) == 1 and len ( window ) == win_length , (
f ' expected a 1D window tensor of size equal to win_length( { win_length } ), but got window with shape { window . shape } . '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
else :
2022-10-23 20:01:27 +08:00
window = paddle . ones ( shape = ( win_length , ) , dtype = x . dtype )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if win_length < n_fft :
pad_left = ( n_fft - win_length ) / / 2
pad_right = n_fft - win_length - pad_left
2022-10-23 20:01:27 +08:00
window = paddle . nn . functional . pad (
window , pad = [ pad_left , pad_right ] , mode = ' constant '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if center :
2022-10-23 20:01:27 +08:00
assert pad_mode in [
' constant ' ,
' reflect ' ,
2023-09-22 10:14:38 +08:00
] , f ' pad_mode should be " reflect " or " constant " , but got " { pad_mode } " . '
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
pad_length = n_fft / / 2
2023-02-24 23:47:07 +08:00
# FIXME: Input `x` can be a complex tensor but pad does not support complex input.
2022-10-23 20:01:27 +08:00
x = paddle . nn . functional . pad (
x . unsqueeze ( - 1 ) ,
pad = [ pad_length , pad_length ] ,
mode = pad_mode ,
data_format = " NLC " ,
) . squeeze ( - 1 )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
x_frames = frame ( x = x , frame_length = n_fft , hop_length = hop_length , axis = - 1 )
x_frames = x_frames . transpose (
2022-10-23 20:01:27 +08:00
perm = [ 0 , 2 , 1 ]
) # switch n_fft to last dim, egs: (batch, num_frames, n_fft)
2022-03-23 13:18:59 +08:00
x_frames = paddle . multiply ( x_frames , window )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
norm = ' ortho ' if normalized else ' backward '
2025-06-19 11:39:33 +08:00
if onesided is None :
onesided = not is_complex ( x_frames )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if is_complex ( x_frames ) :
2025-08-21 02:07:41 +08:00
assert not onesided , (
' onesided should be False when input or window is a complex Tensor. '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if not is_complex ( x ) :
2022-10-23 20:01:27 +08:00
out = fft_r2c (
x = x_frames ,
n = None ,
axis = - 1 ,
norm = norm ,
forward = True ,
onesided = onesided ,
name = name ,
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
else :
2022-10-23 20:01:27 +08:00
out = fft_c2c (
x = x_frames , n = None , axis = - 1 , norm = norm , forward = True , name = name
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
out = out . transpose ( perm = [ 0 , 2 , 1 ] ) # (batch, n_fft, num_frames)
if x_rank == 1 :
out . squeeze_ ( 0 )
return out
2022-10-23 20:01:27 +08:00
def istft (
2024-07-01 04:36:45 +08:00
x : Tensor ,
n_fft : int ,
hop_length : int | None = None ,
win_length : int | None = None ,
window : Tensor | None = None ,
center : bool = True ,
normalized : bool = False ,
onesided : bool = True ,
length : int | None = None ,
return_complex : bool = False ,
name : str | None = None ,
) - > Tensor :
2022-02-24 11:27:33 +08:00
r """
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Inverse short-time Fourier transform (ISTFT).
Reconstruct time-domain signal from the giving complex input and window tensor when
2022-12-15 10:57:42 +08:00
nonzero overlap-add (NOLA) condition is met:
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
.. math::
2022-12-15 10:57:42 +08:00
\ sum_ { t = - \ infty}^ { \ infty} \ text {window} ^2[n - t \ times H] \ \ neq \ 0, \ \ text { for } all \ n
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Where:
- :math:`t`: The :math:`t`-th input window.
- :math:`N`: Value of `n_fft`.
- :math:`H`: Value of `hop_length`.
2022-12-15 10:57:42 +08:00
Result of `istft` expected to be the inverse of `paddle.signal.stft`, but it is
2023-02-24 23:47:07 +08:00
not guaranteed to reconstruct a exactly realizable time-domain signal from a STFT
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
complex tensor which has been modified (via masking or otherwise). Therefore, `istft`
2022-12-15 10:57:42 +08:00
gives the `[Griffin-Lim optimal estimate] <https://ieeexplore.ieee.org/document/1164317>`_
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
(optimal in a least-squares sense) for the corresponding signal.
Args:
2023-02-24 23:47:07 +08:00
x (Tensor): The input data which is a 2-dimensional or 3-dimensional **complex**
2022-09-14 21:56:19 +08:00
Tensor with shape `[..., n_fft, num_frames]`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
n_fft (int): The size of Fourier transform.
2024-07-01 04:36:45 +08:00
hop_length (int|None, optional): Number of steps to advance between adjacent windows
2022-12-15 10:57:42 +08:00
from time-domain signal and `0 < hop_length < win_length`. Default: `None` (
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
treated as equal to `n_fft//4`)
2024-07-01 04:36:45 +08:00
win_length (int|None, optional): The size of window. Default: `None` (treated as equal
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
to `n_fft`)
2024-07-01 04:36:45 +08:00
window (Tensor|None, optional): A 1-dimensional tensor of size `win_length`. It will
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
be center padded to length `n_fft` if `win_length < n_fft`. It should be a
real-valued tensor if `return_complex` is False. Default: `None`(treated as
a rectangle window with value equal to 1 of size `win_length`).
center (bool, optional): It means that whether the time-domain signal has been
center padded. Default: `True`.
2022-12-15 10:57:42 +08:00
normalized (bool, optional): Control whether to scale the output by :math:`1/sqrt(n_ {fft} )`.
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
Default: `False`
onesided (bool, optional): It means that whether the input STFT tensor is a half
of the conjugate symmetry STFT tensor transformed from a real-valued signal
and `istft` will return a real-valued tensor when it is set to `True`.
Default: `True`.
2024-07-01 04:36:45 +08:00
length (int|None, optional): Specify the length of time-domain signal. Default: `None`(
2022-09-14 21:56:19 +08:00
treated as the whole length of signal).
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
return_complex (bool, optional): It means that whether the time-domain signal is
real-valued. If `return_complex` is set to `True`, `onesided` should be set to
2022-09-14 21:56:19 +08:00
`False` cause the output is complex.
2024-07-01 04:36:45 +08:00
name (str|None, optional): The default value is None. Normally there is no need for user
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
to set this property. For more information, please refer to :ref:`api_guide_Name`.
Returns:
A tensor of least squares estimation of the reconstructed signal(s) with shape
2022-12-15 10:57:42 +08:00
`[..., seq_length]`
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2021-10-26 11:00:12 +08:00
Examples:
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
.. code-block:: pycon
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2023-08-30 10:37:35 +08:00
>>> import numpy as np
>>> import paddle
>>> from paddle.signal import stft, istft
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2023-08-30 10:37:35 +08:00
>>> paddle.seed(0)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2023-08-30 10:37:35 +08:00
>>> # STFT
>>> x = paddle.randn([8, 48000], dtype=paddle.float64)
>>> y = stft(x, n_fft=512)
>>> print(y.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([8, 257, 376])
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2023-08-30 10:37:35 +08:00
>>> # ISTFT
>>> x_ = istft(y, n_fft=512)
>>> print(x_.shape)
[CodeStyle][Xdoctest][8,12,15,16,18-20,22-26,29-32,34-36,38-40,42,43,45-48,50,51,60-65,75,80,82,83,85-87,89-94,99-141,143,145,147-167,169-187,207-220,257,258,260-275,277-313,315-325][API Compatibility] Update shape output format in documentation examples (#76574)
---------
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
2025-11-26 10:31:46 +08:00
paddle.Size([8, 48000])
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
2023-08-30 10:37:35 +08:00
>>> np.allclose(x, x_)
True
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
"""
check_variable_and_dtype ( x , ' x ' , [ ' complex64 ' , ' complex128 ' ] , ' istft ' )
x_rank = len ( x . shape )
2022-10-23 20:01:27 +08:00
assert x_rank in [
2 ,
3 ,
2023-09-22 10:14:38 +08:00
] , f ' x should be a 2D or 3D complex tensor, but got rank of x is { x_rank } '
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if x_rank == 2 : # (batch, n_fft, n_frames)
x = x . unsqueeze ( 0 )
if hop_length is None :
hop_length = int ( n_fft / / 4 )
if win_length is None :
win_length = n_fft
# Assure no gaps between frames.
2025-08-21 02:07:41 +08:00
assert 0 < hop_length < = win_length , (
f ' hop_length should be in (0, win_length( { win_length } )], but got { hop_length } . '
)
2022-10-23 20:01:27 +08:00
2025-08-21 02:07:41 +08:00
assert 0 < win_length < = n_fft , (
f ' win_length should be in (0, n_fft( { n_fft } )], but got { win_length } . '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
n_frames = x . shape [ - 1 ]
fft_size = x . shape [ - 2 ]
2023-05-22 20:56:38 +08:00
if in_dynamic_mode ( ) :
2025-07-18 11:39:17 +08:00
assert x . size != 0 , ' x should not be an empty tensor. '
2022-03-23 13:18:59 +08:00
if onesided :
2025-08-21 02:07:41 +08:00
assert fft_size == n_fft / / 2 + 1 , (
f ' fft_size should be equal to n_fft // 2 + 1( { n_fft / / 2 + 1 } ) when onesided is True, but got { fft_size } . '
)
2022-03-23 13:18:59 +08:00
else :
2025-08-21 02:07:41 +08:00
assert fft_size == n_fft , (
f ' fft_size should be equal to n_fft( { n_fft } ) when onesided is False, but got { fft_size } . '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if window is not None :
2025-08-21 02:07:41 +08:00
assert len ( window . shape ) == 1 and len ( window ) == win_length , (
f ' expected a 1D window tensor of size equal to win_length( { win_length } ), but got window with shape { window . shape } . '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
else :
2022-10-23 20:01:27 +08:00
window_dtype = (
paddle . float32
if x . dtype in [ paddle . float32 , paddle . complex64 ]
else paddle . float64
)
window = paddle . ones ( shape = ( win_length , ) , dtype = window_dtype )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if win_length < n_fft :
pad_left = ( n_fft - win_length ) / / 2
pad_right = n_fft - win_length - pad_left
2023-02-24 23:47:07 +08:00
# FIXME: Input `window` can be a complex tensor but pad does not support complex input.
2022-10-23 20:01:27 +08:00
window = paddle . nn . functional . pad (
window , pad = [ pad_left , pad_right ] , mode = ' constant '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
x = x . transpose (
2022-10-23 20:01:27 +08:00
perm = [ 0 , 2 , 1 ]
) # switch n_fft to last dim, egs: (batch, num_frames, n_fft)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
norm = ' ortho ' if normalized else ' backward '
if return_complex :
2025-08-21 02:07:41 +08:00
assert not onesided , (
' onesided should be False when input(output of istft) or window is a complex Tensor. '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
out = fft_c2c ( x = x , n = None , axis = - 1 , norm = norm , forward = False , name = None )
else :
2025-08-21 02:07:41 +08:00
assert not is_complex ( window ) , (
' Data type of window should not be complex when return_complex is False. '
)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if onesided is False :
2022-10-23 20:01:27 +08:00
x = x [ : , : , : n_fft / / 2 + 1 ]
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
out = fft_c2r ( x = x , n = None , axis = - 1 , norm = norm , forward = False , name = None )
2022-03-23 13:18:59 +08:00
out = paddle . multiply ( out , window ) . transpose (
2022-10-23 20:01:27 +08:00
perm = [ 0 , 2 , 1 ]
) # (batch, n_fft, num_frames)
out = overlap_add (
x = out , hop_length = hop_length , axis = - 1
) # (batch, seq_length)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
window_envelop = overlap_add (
x = paddle . tile (
2022-03-23 13:18:59 +08:00
x = paddle . multiply ( window , window ) . unsqueeze ( 0 ) ,
2022-10-23 20:01:27 +08:00
repeat_times = [ n_frames , 1 ] ,
2025-08-21 02:07:41 +08:00
) . transpose ( perm = [ 1 , 0 ] ) , # (n_fft, num_frames)
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
hop_length = hop_length ,
2022-10-23 20:01:27 +08:00
axis = - 1 ,
) # (seq_length, )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
if length is None :
if center :
2022-10-23 20:01:27 +08:00
out = out [ : , ( n_fft / / 2 ) : - ( n_fft / / 2 ) ]
window_envelop = window_envelop [ ( n_fft / / 2 ) : - ( n_fft / / 2 ) ]
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
else :
if center :
start = n_fft / / 2
else :
start = 0
2022-10-23 20:01:27 +08:00
out = out [ : , start : start + length ]
window_envelop = window_envelop [ start : start + length ]
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
# Check whether the Nonzero Overlap Add (NOLA) constraint is met.
2023-05-22 20:56:38 +08:00
if in_dynamic_mode ( ) and window_envelop . abs ( ) . min ( ) . item ( ) < 1e-11 :
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
raise ValueError (
' Abort istft because Nonzero Overlap Add (NOLA) condition failed. For more information about NOLA constraint please see `scipy.signal.check_NOLA`(https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.check_NOLA.html). '
)
out = out / window_envelop
if x_rank == 2 :
2025-04-18 18:58:43 +08:00
out = paddle . squeeze ( out , axis = 0 )
Add FFT related operators and APIs (#35665)
* 1. add interface for fft;
2. add data type predicate;
3. fix paddle.roll.
* add fft c2c cufft kernel
* implement argument checking & op calling parts for fft_c2c and fftn_c2c
* add operator and opmaker definitions
* only register float and double for cpu.
* add common code for implementing FFT, add pocketfft as a dependency
* add fft c2c cufft kernel function
* fix bugs in python interface
* add support for c2r, r2c operators, op makers, kernels and kernel functors.
* test and fix bugs
* 1. fft_c2c function: add support for onesided=False;
2. add complex<float>, complex<double> support for concat and flip.
* 1. fft: fix python api bugs;
2. shape_op: add support for complex data types.
* fft c2c cufft kernel done with complie and link
* fix shape_op, add mkl placeholder
* remove mkl
* complete fft c2c in gpu
* 1. implement mkl-based fft, FFTC2CFunctor and common function exec_fft;
2. change the design, add input and output typename as template parameter for all FFTFunctors, update pocketfft-based implementation.
* complete fft c2c on gpu in ND
* complete fft c2c on gpu in ND
* complete fft c2c backward in ND
* fix MKL-based implementation
* Add frame op and CPU/GPU kernels.
* Add frame op forward unittest.
* Add frame op forward unittest.
* Remove axis parameter in FrameFunctor.
* Add frame op grad CPU/GPU kernels and unittest.
* Add frame op grad CPU/GPU kernels and unittest.
* Update doc string.
* Update after review and remove librosa requirement in unittest.
* Update grad kernel.
* add fft_c2r op
* Remove data allocation in TransCompute function.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* last fft c2r functor
* fix C2R and R2C for cufft, becase the direction is not an option in these cases.
* add fft r2c onesided with cpu(pocketfft/mkl) and gpu
* fix bugs in python APIs
* fix fft_c2r grad kernal
* fix bugs in python APIs
* add cuda fft c2r grad kernal functor
* clean code
* fix fft_c2r python API
* fill fft r2c result with conjugate symmetry (#19)
fill fft r2c result with conjugate symmetry
* add placeholder for unittests (#24)
* simple parameterize test function by auto generate test case from parm list (#25)
* miscellaneous fixes for python APIs (#26)
* add placeholder for unittests
* resize fft inputs before computation is n or s is provided.
* add complex kernels for pad and pad_grad
* simplify argument checking.
* add type promotion
* add int to float or complex promotion
* fix output data type for static mode
* fix fft's input dtype dispatch, import fft to paddle
* fix typos in axes checking (#27)
* fix typos in axes checking
* fix argument checking (#28)
* fix argument checking
* Add C2R Python layer normal and abnormal use cases (#29)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* complete rfft,rfft2,rfftn,ihfft,ihfft2,ihfftn unittest and doc string (#30)
* Documentation of the common interfaces of c2r and c2c (#31)
* Documentation of the common interfaces of c2r and c2c
* clean c++ code (#32)
* clean code
* Add numpy-based implementation of spectral ops (#33)
* add numpy reference implementation of spectral ops
* Add fft_c2r numpy based implementation for unittest. (#34)
* add fft_c2r numpy implementation
* Add deframe op and stft/istft api. (#23)
* Add frame api
* Add deframe op and kernels.
* Add stft and istft apis.
* Add deframe api. Update stft and istft apis.
* Fix bug in frame_from_librosa function when input dims >= 3
* Rename deframe to overlap_add.
* Update istft.
* Update after code review.
* Add overlap_add op and stft/istft api unittest (#35)
* Add overlap_add op unittest.
* Register complex kernels of squeeze/unsquuze op.
* Add stft/istft api unittest.
* Add unittest for fft helper functions (#36)
* add unittests for fft helper functions. add complex kernel for roll op.
* complete static graph unittest for all public api (#37)
* Unittest of op with FFT C2C, C2R and r2c added (#38)
* documents and single case
* test c2r case
* New C2R Python layer normal and exception use cases
* Documentation of the common interfaces of c2r and c2c
* Unittest of op with FFT C2C, C2R and r2c added
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
* add fft related options to CMakeLists.txt
* fix typos and clean code (#39)
* fix invisible character in mkl branch and fix error in error message
* clean code: remove docstring from unittest for signal.py.
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype. (#40)
* always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
* fix CI Errors: numpy dtype comparison, thrust when cuda is not available (#41)
1. always convert numpy array to paddle.Tensor to avoid comparing numpy dtype with paddle dtype.
2. promote floating point tensor to complex tensor ior fft_c2c and fft_c2r;
3. fix unittest to catch UnImplementedError and RuntimeError;
4. fix compile error by avoid using thrust when cuda is not available.
5. fix sample code, use paddle.fft instead of paddle.tensor.fft
* remove inclusion of thrust, add __all__ list for fft (#42)
* Add api doc and update unittest. (#43)
* Add doc strings.
* Update overlap_add op unittest
* fix MKL-based FFT implementation (#44)
* fix MKL-based FFT implementation, MKL CDFT's FORWARD DOMAIN is always REAL for R2C and C2R
* remove code for debug (#45)
* use dynload for cufft (#46)
* use std::ptrdiff_t as datatype of stride (instead of int64_t) to avoid argument mismatch on some platforms.
* add complex support for fill_zeros_like
* use dynload for cufft
* Update doc and unittest. (#47)
* Add doc of frame op and overlap_add op.
* Update unittest.
* use dynload for cufft (#48)
1. use dynload for cufft
2. fix unittest;
3. temporarily disable Rocm.
* fix conflicts and merge upstream (#49)
fix conflicts and merge upstream
* fix compile error: only link dyload_cuda when cuda is available (#50)
* fix compile error: only link dyload_cuda when cuda is available
* fix dynload for cufft on windows (#51)
1. fix dynload for cufft on windows;
2. fix unittests.
* add NOMINMAX to compile on windows (#52)
add NOMINMAX to compile on windows
* explicitly specify capture mode for lambdas (#55)
explicitly specify capture mode for lambdas
* fix fft sample (#53)
* fix fft sample
* update scipy and numpy version for unittests of fft (#56)
update scipy and numpy version for unittests of fft
* Add static graph unittests of frame and overlap_add api. (#57)
* Remove cache of cuFFT & Disable ONEMKL (#59)
1. replace numpy.fft with scipy.fft as numpy<1.20 not support ortho norm
2. remove cache of cufft plans;
3. enhance error checking.
4. default WITH_ONEMKL to OFF
Co-authored-by: jeff41404 <jeff41404@gmail.com>
Co-authored-by: root <root@bjyz-sys-gpu-kongming9.bjyz.baidu.com>
Co-authored-by: KP <109694228@qq.com>
Co-authored-by: lijiaqi <lijiaqi0612@163.com>
Co-authored-by: Xiaoxu Chen <chenxx_id@163.com>
Co-authored-by: lijiaqi0612 <33169170+lijiaqi0612@users.noreply.github.com>
2021-09-18 13:49:41 +08:00
return out