【Hackathon 9th No.25】add test_fused_get_rotary_embedding by Echo-Nie · Pull Request #3892 · PaddlePaddle/FastDeploy (original) (raw)
你好,只比较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~