Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roll_op: support Tensor as input for shifts #36727

Merged
merged 2 commits into from
Oct 26, 2021

Conversation

iclementine
Copy link

@iclementine iclementine commented Oct 26, 2021

PR types

Function optimization

PR changes

Ops

Describe

roll_op: support Tensor as input for shifts

Roll_op does not support "shifts" as a tensor input, since it is defined as an attribute, which has to ben known at graph assembly stage. This restrict the expressiveness of this function, becase the amount of shits may depend on the shape of the input or other runtime information.

import paddle
paddle.enable_static()

x = paddle.arange(24).reshape([4, 6])
shifts = paddle.shape(x) // 2
y = paddle.roll(x, shifts=x, axis=[0, 1])

exe = paddle.static.Executor()
y_np = exe.run(fetch_list=[y])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@iclementine iclementine merged commit 7b1e30f into PaddlePaddle:develop Oct 26, 2021
cxxly pushed a commit to cxxly/Paddle that referenced this pull request Oct 26, 2021
XiaoguangHu01 pushed a commit that referenced this pull request Oct 28, 2021
* update fft api path (#36219)

* update fft api path
* add sample code for ihfft2

Co-authored-by: chenfeiyu <[email protected]>

* fix fft axis (#36321)

fix: `-1` is used when fft's axis is `0`

* use unified external error message for cufft api (#36114)

* fft: modify sample code result (#36325)

* dynamic load mkl as a fft backend when it is avaialble and requested (#36414)

* add rocm support for fft api (#36415)

* move signal apis

* move fft and signal API path (#2)

* move signal apis

* move fft.py and signal.py to paddle/, fix typos

* fix relative imports from fft.py and signal.py

* fix typos in signal.py (#3)

* move signal apis

* move fft.py and signal.py to paddle/, fix typos

* fix relative imports from fft.py and signal.py

* fix typos

* disable Cache when CUFFT_VERSION >= 10200 (#4)

* move signal apis

* move fft.py and signal.py to paddle/, fix typos

* fix relative imports from fft.py and signal.py

* fix typos

* Add LRUCache for fft plans

* add LRUCache for cuff and hipfft (#5)

* move signal apis

* move fft.py and signal.py to paddle/, fix typos

* fix relative imports from fft.py and signal.py

* fix typos

* WIP: add cache

* delete move constructor and operator= for CuFFTHandle and FFTConfig

* remove log from CuFFTHandle and FFTConfig

* add lrucache for fft rocm backend

* disable LRUCache when CUFFT_VERSION >= 10200

* disbale copy and move for hipFFTHandle; format code

Co-authored-by: Xiaoxu Chen <[email protected]>

* remove debug message of cufftHandler

* roll_op: support Tensor as input for shifts (#36727)

* fix fftshift/ifftshift on static mode

* update roll_op version

* add more test cases for fftshift/ifftshift

Co-authored-by: zhiboniu <[email protected]>
Co-authored-by: chenfeiyu <[email protected]>
Co-authored-by: LJQ❤️ <[email protected]>
ghost pushed a commit to piotrekobi/Paddle that referenced this pull request Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants