IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

flash_attention_ragged_gpu

flash_attention_ragged_gpu()​

max.experimental.nn.common_layers.functional_kernels.flash_attention_ragged_gpu(q, k, v, input_row_offsets, max_seq_len, mask_variant, scale, local_window_size=-1)

source

Computes flash attention for ragged inputs using a GPU-optimized kernel, without a KV cache.

Parameters:

Returns:

The output tensor, of shape [total_seq_len, num_heads, head_dim].

Return type:

TensorValue