-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
modify roll test=develop #25321
modify roll test=develop #25321
Conversation
Thanks for your contribution! |
@@ -104,7 +104,7 @@ def flip(input, dims, name=None): | |||
return out | |||
|
|||
|
|||
def roll(input, shifts, dims=None): | |||
def roll(input, shifts, axis=None, name=None): | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be : paddle.tensor.roll(x, shifts, axis=None, name=None)
according to the latest argument convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
python/paddle/tensor/manipulation.py
Outdated
@@ -117,7 +117,7 @@ def roll(input, shifts, dims=None): | |||
input (Variable): The input tensor variable. | |||
shifts (int|list|tuple): The number of places by which the elements | |||
of the `input` tensor are shifted. | |||
dims (int|list|tuple|None): Dimentions along which to roll. | |||
axis (int|list|tuple|None): Dimentions along which to roll. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dimensions -> axis
上面的简介部分:``Roll the input tensor along ...'' 需要换一种说法, character level copy是不可以的。
示例代码中用paddle.enable_imperative()
开启动态图模式,方便未来默认动态图的时候统一调整示例代码。
"Attr(dims[%d]) is out of range, It's expected " | ||
"to be in range of [-%d, %d]. But received Attr(dims[%d]) = %d.", | ||
"Attr(axis[%d]) is out of range, It's expected " | ||
"to be in range of [-%d, %d]. But received Attr(axis[%d]) = %d.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python端也增加对axis范围的检查,防止打印出来call stack。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the changes of Attrs of roll op, but please node that it will cause that Paddle inference library of 2.0 version to load model trained by the old version failed.
PR types
OthersPR changes
APIsDescribe
According to paddle 2.0 standard
1, change attr name 'dim' to 'axis'
2, change api input name 'input' to 'x'
3, add check axis value in python code and related ut.
4,change example code to imperative mode