-
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
Add split selected rows op #7604
Add split selected rows op #7604
Conversation
: OpProtoAndCheckerMaker(proto, op_checker) { | ||
AddInput("X", "The input SelectedRows."); | ||
AddOutput("Out", "The outputs of input SelectedRows.").AsDuplicable(); | ||
AddAttr<std::vector<int>>("rows_section", "Rows section for output.") |
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.
rows_section
=> `rows_sections
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.
AddOutput("Out", "The outputs of input SelectedRows.").AsDuplicable(); | ||
AddAttr<std::vector<int>>("rows_section", "Rows section for output.") | ||
.SetDefault(std::vector<int>({})); | ||
AddAttr<std::vector<int>>("height_section", |
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.
height_sections
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.
|
||
AddComment(R"DOC( | ||
Split a SelectedRows with a specified rows section. | ||
You could set height_section for specified the height for each output. |
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.
height_sections
is only needed when need to split the dims of the original tensor.
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.
} | ||
}; | ||
|
||
class SplitSelectedRowsGradMaker : public framework::SingleGradOpDescMaker { |
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.
I didn't see a grad kernel implementation, did you missed that?
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.
We reuse sum
op as the grad op, and I will add the unit test for it.
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.
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.
Do you need to register the sum kernel as the grad kernel?
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.
Maybe don't need, just inherit framework::SingleGradOpDescMaker
, we can use another Operator as the grad op.
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++
Fixed #7558