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

[Zero-Dim] Support 0D Tensor input for topk/broadcast_to/expand/expand_as/broadcast_shape #50536

Merged
merged 25 commits into from
Feb 24, 2023

Conversation

yunyaoXYY
Copy link
Contributor

PR types

Bug fixes

PR changes

APIs

Describe

None

@paddle-bot
Copy link

paddle-bot bot commented Feb 15, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

chenwhql
chenwhql previously approved these changes Feb 21, 2023
Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

LGTM for PADDLE_ENFORCE

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

XPU挂了 建议分开提,先把CPU/GPU支持下,不然PR比较大

x = paddle.full([], 1, 'float32')
out, indices = paddle.topk(x, k=1, axis=0)
prog = paddle.static.default_main_program()
res = self.exe.run(prog, fetch_list=[x, out])
Copy link
Contributor

Choose a reason for hiding this comment

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

测下indices吧,应该是shape为[],值为0

paddle/phi/kernels/xpu/expand_as_kernel.cc Outdated Show resolved Hide resolved
self.assertEqual(res[0].shape, ())
self.assertEqual(res[0], 1.0)
self.assertEqual(res[1].shape, ())
self.assertEqual(res[1], 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.

topk也需要测下反向

@@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Note:
Copy link
Contributor

Choose a reason for hiding this comment

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

这个需要留着

@@ -330,6 +330,79 @@ def setUp(self):
paddle.disable_static()
self.x = paddle.rand([])

def test_expand(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

XPU的case和动态图保持一致吧

python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
paddle/phi/kernels/xpu/top_k_kernel.cc Outdated Show resolved Hide resolved
paddle/phi/kernels/gpu/top_k_kernel.cu Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
zhwesky2010
zhwesky2010 previously approved these changes Feb 23, 2023
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

jzhang533
jzhang533 previously approved these changes Feb 24, 2023
Copy link
Contributor

@jzhang533 jzhang533 left a comment

Choose a reason for hiding this comment

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

LGTM

@yunyaoXYY yunyaoXYY dismissed stale reviews from jzhang533 and zhwesky2010 via 7d8a630 February 24, 2023 02:27
jzhang533
jzhang533 previously approved these changes Feb 24, 2023
Copy link
Contributor

@jzhang533 jzhang533 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 5041158 into PaddlePaddle:develop Feb 24, 2023
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.

None yet

5 participants