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

Fix and omptimize flip API #34379

Merged
merged 3 commits into from
Jul 26, 2021
Merged

Fix and omptimize flip API #34379

merged 3 commits into from
Jul 26, 2021

Conversation

sljlp
Copy link
Contributor

@sljlp sljlp commented Jul 26, 2021

PR types

Function optimization

PR changes

APIs

Describe

  1. add a feature supporting axis's type to be int in paddle.flip
  2. use core.ops.flip in dygraph mode
  3. update English doc for paddle.flip

@paddle-bot-old
Copy link

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

@@ -240,10 +240,17 @@ def flip(x, axis, name=None):
x = np.arange(image_shape[0] * image_shape[1] * image_shape[2]).reshape(image_shape)
x = x.astype('float32')
img = paddle.to_tensor(x)
out = paddle.flip(img, [0,1])
tmp = paddle.flip(img, [0,1])
print(tmp) # [[[10,11][8, 9]],[[6, 7],[4, 5]] [[2, 3],[0, 1]]]
Copy link
Contributor

Choose a reason for hiding this comment

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

结果里面是不是有逗号少了


print(out) # [[[10,11][8, 9]],[[6, 7],[4, 5]] [[2, 3],[0, 1]]]
out = paddle.flip(tmp,-1)
print(out) # [[[11,10][9, 8]],[[7, 6],[5, 4]] [[3, 2],[1, 0]]]
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@wangxicoding wangxicoding left a comment

Choose a reason for hiding this comment

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

LGTM

@wangxicoding wangxicoding merged commit df27c26 into PaddlePaddle:develop Jul 26, 2021
@sljlp sljlp deleted the fix_and_ompt_flip branch July 27, 2021 12:21
fuyinno4 pushed a commit that referenced this pull request Jul 29, 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.

3 participants