Repository navigation
[0-size Tensor No.88] Add 0-size Tensor support for paddle.incubate.nn.functional.variable_length_memory_efficient_attention [fluid_ops] - #74157
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
/re-run all-failed |
|
@DanielSun11 CI已完成需要review |
| if (mask_dims[1] == 0 && query_num_head != 0) { | ||
| query_num_head = 0; | ||
| } | ||
| } |
There was a problem hiding this comment.
paddle特有的api,API的描述如下:
Cutlass Memory Efficient Variable Attention.
This method requires SM_ARCH in sm70, sm75, sm80.
Args:
query (Tensor): The Query Tensor. Its shape is [batchsize, num_head, seq_len, head_size].
key (Tensor): The Key Tensor. Its shape is [batchsize, num_head, seq_len, head_size].
value (Tensor): The Value Tensor. Its shape is [batchsize, num_head, seq_len, head_size].
seq_lens (Tensor): The sequence lengths of the sequences in the batch, used to index query. Its shape is [batchsize, 1].
kv_seq_lens (Tensor): The sequence lengths of the sequences in the batch, used to index key and value. Its shape is [batchsize, 1].
mask (Tensor|None, optional): The Mask Tensor. Its shape is [batchsize, 1, query_seq_len, key_seq_len].
scale (Float|None, optional): The attention matrix's scale. Default is sqrt(1.0 / head_size).
causal (Bool): Whether causal masking is used or not. Default is False.
pre_cache_length (Int): The length of the pre-cache. Default is 0.
Returns:
Tensor, the output Tensor.“
明确了q k v的shape应该完全一致以及明确了mask的shape要求。因此不需要针对0-size跳过一些检查,应当保证api描述中对shape的要求。不合法的case可以从paddleapitest中删除或者更改为符合shape要求的0-size 测试case。paddleapitest中的一些case是生成的,不需要完全拟合测试case,可根据api的描述删掉/更改一些不合法的case。但是需要至少保留几个有效的测试case,以测试0-size的场景是否报错
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #74157 +/- ##
==========================================
Coverage ? 0
==========================================
Files ? 0
Lines ? 0
Branches ? 0
==========================================
Hits ? 0
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/re-run all-failed |
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
infermeta 增加key_num_head不为0时计算除法,符号推导没有对应代码
out numel为0返回
增加单测
PaddleAPITest 修改后的测试用例通过
