flashinfer.testing.attention_tflops_per_sec_with_actual_seq_lens¶
- flashinfer.testing.attention_tflops_per_sec_with_actual_seq_lens(actual_seq_lens_q, actual_seq_lens_kv, head_dim_qk, head_dim_vo, num_qo_heads, causal, ms)¶
根据实际序列长度计算给定注意力层的每秒 TFLOPS 数。不假设批处理中所有序列长度都相同。
- 参数:
actual_seq_lens_q (torch.Tensor) – 查询的实际序列长度数组。
actual_seq_lens_kv (torch.Tensor) – 键和值的实际序列长度数组。
head_dim_qk (int) – 查询和键的头部维度。
head_dim_vo (int) – 值的头部维度。
num_qo_heads (int) – 查询头数。
causal (bool) – 是否使用因果掩码。
ms (float) – 毫秒级的执行时间。
- 返回值:
该层的每秒 TFLOPS 数。
- 返回值类型:
tflops_per_sec (float)