---
title: "attentionVarlen"
sidebar_label: "attentionVarlen"
description: "Kotlin binding reference: attentionVarlen."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Ops](index.md)/[attentionVarlen](attentionVarlen.md)

# attentionVarlen

[common]\
fun [attentionVarlen](attentionVarlen.md)(query: [Tensor](../Tensor/index.md), key: [Tensor](../Tensor/index.md), value: [Tensor](../Tensor/index.md), cuSeqlensQ: [Tensor](../Tensor/index.md), cuSeqlensK: [Tensor](../Tensor/index.md), maxSeqlenQ: [Tensor](../Tensor/index.md)? = null, maxSeqlenK: [Tensor](../Tensor/index.md)? = null, attnMask: [Tensor](../Tensor/index.md)? = null, headSink: [Tensor](../Tensor/index.md)? = null, isCausal: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null, qScale: [Tensor](../Tensor/index.md)? = null, softcap: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, slidingWindow: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)? = null, smoothSoftmax: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null, kScale: [Tensor](../Tensor/index.md)? = null, vScale: [Tensor](../Tensor/index.md)? = null, keptPrefix: [Tensor](../Tensor/index.md)? = null, kvPositionOffset: [Tensor](../Tensor/index.md)? = null): [Tensor](../Tensor/index.md)

`attentionVarlen(query: Tensor, key: Tensor, value: Tensor, cuSeqlensQ: Tensor, cuSeqlensK: Tensor, maxSeqlenQ: Tensor? = null, maxSeqlenK: Tensor? = null, attnMask: Tensor? = null, headSink: Tensor? = null, isCausal: Boolean? = null, qScale: Tensor? = null, softcap: Double? = null, slidingWindow: Long? = null, smoothSoftmax: Boolean? = null, kScale: Tensor? = null, vScale: Tensor? = null, keptPrefix: Tensor? = null, kvPositionOffset: Tensor? = null)`: the `attention_varlen` operator. Variable-length (packed) form of `attention`: the serving riders over token-packed ragged batches. Tensors and offsets follow `scaled_dot_product_attention_varlen`; the riders (`head_sink`, `softcap`, `sliding_window`, `smooth_softmax`) follow `attention`.