-
Notifications
You must be signed in to change notification settings - Fork 5.9k
【PIR Dist Op Reg No.2】 reg distributed_push_sparse #60805
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d7ee10b
fix
enkilee d93ed4d
str
enkilee 6f1a20d
str
enkilee 94806a9
fix
enkilee 6c28e31
fix
enkilee 86d3f0e
fix
enkilee 0edd932
Merge branch 'develop' into PIR-optest-fix-2
enkilee 0f56b02
fix
enkilee 74d0a4a
Merge branch 'PIR-optest-fix-2' of https://github.com/enkilee/Paddle …
enkilee e79e978
Merge branch 'develop' into PIR-optest-fix-2
enkilee 2a8ed57
fix
enkilee d549503
Merge branch 'PIR-optest-fix-2' of https://github.com/enkilee/Paddle …
enkilee 5e38c70
rename
enkilee 60dfc4e
fix codestyle
enkilee f2ee099
remove test file
enkilee 4613c7e
Merge branch 'PaddlePaddle:develop' into PIR-optest-fix-2
enkilee b85d7ad
fix
enkilee 8f1b6f9
fix
enkilee 8d2a590
Merge branch 'PaddlePaddle:develop' into PIR-optest-fix-2
enkilee acc8b89
fix
enkilee 2e751fa
fix
enkilee 3a33c13
fix
enkilee b7caa42
Merge branch 'develop' into PIR-optest-fix-2
enkilee d34edc3
fix
enkilee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
test/ir/pir/translator/test_distributed_push_sparse_translator.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import unittest | ||
|
|
||
| import numpy as np | ||
| import test_op_translator | ||
|
|
||
| import paddle | ||
| from paddle.base.framework import ( | ||
| convert_np_dtype_to_dtype_, | ||
| ) | ||
| from paddle.base.layer_helper import LayerHelper | ||
|
|
||
|
|
||
| class TestDistributedPushSparseOpTranslator( | ||
| test_op_translator.TestOpTranslator | ||
| ): | ||
| def append_op(self): | ||
| self.op_type = "distributed_push_sparse" | ||
| ids = paddle.ones(shape=(1, 1), dtype='float32') | ||
| shows = paddle.ones(shape=(1, 1), dtype='float32') | ||
| clicks = paddle.ones(shape=(1, 1), dtype='float32') | ||
| output = paddle.ones(shape=(1, 1), dtype='float32') | ||
| attrs = { | ||
| 'table_id': 0, | ||
| 'size': 8, | ||
| 'is_distributed': False, | ||
| 'push_sparse_version': 'push_sparse', | ||
| 'padding_idx': -1, | ||
| 'dtype': convert_np_dtype_to_dtype_(np.float32), | ||
| 'is_test': False, | ||
| 'use_cvm_op': False, | ||
| } | ||
| helper = LayerHelper(self.op_type) | ||
| helper.append_op( | ||
| type=self.op_type, | ||
| inputs={"Ids": [ids], "Shows": shows, "Clicks": clicks}, | ||
| outputs={"Outputs": [output]}, | ||
| attrs=attrs, | ||
| ) | ||
|
|
||
| def test_translator(self): | ||
| self.check() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
这个output不需要设置dim信息吗?
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.
原本的InferShape里并没有相关代码,这类Op一般是通过pass插入,不是正常组网得到的,我觉得还是不加为好。