Skip to content

Conversation

Echo-Nie
Copy link
Contributor

@Echo-Nie Echo-Nie commented Sep 4, 2025

test_fused_get_rotary_embedding

Copy link

paddle-bot bot commented Sep 4, 2025

Thanks for your contribution!

Copy link
Collaborator

@zoooo0820 zoooo0820 left a comment

Choose a reason for hiding this comment

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

你好,只比较shape是否符合预期,很难监控到可能出现的精度问题;按照自定义算子的检查标准,最好通过numpy/paddle的已有操作得到一个基础版本实现作为基准,并使用同样的输入比较两个版本的输出是否一致

可以参考下面单测的形式(不一定和本算子当前的功能行为一致,仅供参考)
https://github.com/PaddlePaddle/Paddle/blob/1d9df745e8a9a58c54e770b2b97dff89153017e4/test/legacy_test/test_fused_rotary_position_embedding.py#L117

@Echo-Nie
Copy link
Contributor Author

Echo-Nie commented Sep 6, 2025

你好,只比较shape是否符合预期,很难监控到可能出现的精度问题;按照自定义算子的检查标准,最好通过numpy/paddle的已有操作得到一个基础版本实现作为基准,并使用同样的输入比较两个版本的输出是否一致

Thx, Done.
The print info:

[Test case] batch_size=2, seq_len=4, head_dim=8, prompt_num=0
Output shape (op): (2, 2, 1, 4, 8), Output shape (ref): (2, 2, 1, 4, 8)
Diff: max=5.960e-08, mean=4.951e-09, std=1.507e-08
.
[Test case] batch_size=1, seq_len=2, head_dim=2, prompt_num=0
Output shape (op): (2, 1, 1, 2, 2), Output shape (ref): (2, 1, 1, 2, 2)
Diff: max=5.960e-08, mean=1.490e-08, std=2.581e-08
.
[Test case] batch_size=2, seq_len=4, head_dim=8, prompt_num=3
Output shape (op): (2, 2, 1, 4, 8), Output shape (ref): (2, 2, 1, 4, 8)
Diff: max=5.960e-08, mean=2.969e-09, std=1.142e-08
.
----------------------------------------------------------------------
Ran 3 tests in 0.216s

OK

@zoooo0820 pls review~

@zoooo0820
Copy link
Collaborator

你好,只比较shape是否符合预期,很难监控到可能出现的精度问题;按照自定义算子的检查标准,最好通过numpy/paddle的已有操作得到一个基础版本实现作为基准,并使用同样的输入比较两个版本的输出是否一致

Thx, Done. The print info:

[Test case] batch_size=2, seq_len=4, head_dim=8, prompt_num=0
Output shape (op): (2, 2, 1, 4, 8), Output shape (ref): (2, 2, 1, 4, 8)
Diff: max=5.960e-08, mean=4.951e-09, std=1.507e-08
.
[Test case] batch_size=1, seq_len=2, head_dim=2, prompt_num=0
Output shape (op): (2, 1, 1, 2, 2), Output shape (ref): (2, 1, 1, 2, 2)
Diff: max=5.960e-08, mean=1.490e-08, std=2.581e-08
.
[Test case] batch_size=2, seq_len=4, head_dim=8, prompt_num=3
Output shape (op): (2, 2, 1, 4, 8), Output shape (ref): (2, 2, 1, 4, 8)
Diff: max=5.960e-08, mean=2.969e-09, std=1.142e-08
.
----------------------------------------------------------------------
Ran 3 tests in 0.216s

OK

@zoooo0820 pls review~

看起来没问题,我跟进下CI报错

zoooo0820
zoooo0820 previously approved these changes Sep 12, 2025
Copy link
Collaborator

@zoooo0820 zoooo0820 left a comment

Choose a reason for hiding this comment

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

LGTM

EmmonsCurse
EmmonsCurse previously approved these changes Sep 12, 2025
Copy link
Collaborator

@EmmonsCurse EmmonsCurse left a comment

Choose a reason for hiding this comment

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

LGTM

@Echo-Nie Echo-Nie dismissed stale reviews from zoooo0820 and EmmonsCurse via 02920fc September 12, 2025 05:04
@Echo-Nie
Copy link
Contributor Author

抱歉之前的代码不小心把开源软件的版权和许可声明的注释删掉了,刚刚发现,补充了一下。

@zoooo0820 zoooo0820 merged commit 06f4b49 into PaddlePaddle:develop Sep 12, 2025
25 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants