-
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
Enhance LoDResetOp and add python wrapper #9204
Conversation
then we get an 1-level LoDTensor | ||
Out.lod = [[ 0, 4, 6 ]] | ||
Out.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]] | ||
Out.dims = [6, 1] |
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.
Add example for Y.
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.
Done.
"variable inherits from."); | ||
AddInput("Y", | ||
"(Tensor, LoDTensor, optional) If provided, lod of Input(Y) would " | ||
"be considered as the target lod first, otherwise data of " |
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.
If provided and Y is LoDTensor, ..., otherwise ?
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.
Done.
python/paddle/fluid/layers/nn.py
Outdated
@@ -3292,3 +3293,98 @@ def autoincreased_step_counter(counter_name=None, begin=1, step=1): | |||
counter.stop_gradient = True | |||
|
|||
return counter | |||
|
|||
|
|||
def lod_reset(x, y, target_lod=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.
def lod_reset(x, y=None, target_lod=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.
y == None and target_lod == None? Seems that we prefer target lod from y.
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.
Resolves #9171