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

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

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

# scaledDotProductAttentionVarlen

[common]\
fun [scaledDotProductAttentionVarlen](scaledDotProductAttentionVarlen.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, isCausal: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = false, qScale: [Tensor](../Tensor/index.md)? = null, kScale: [Tensor](../Tensor/index.md)? = null, vScale: [Tensor](../Tensor/index.md)? = null): [Tensor](../Tensor/index.md)

`scaledDotProductAttentionVarlen(query: Tensor, key: Tensor, value: Tensor, cuSeqlensQ: Tensor, cuSeqlensK: Tensor, maxSeqlenQ: Tensor? = null, maxSeqlenK: Tensor? = null, attnMask: Tensor? = null, isCausal: Boolean = false, qScale: Tensor? = null, kScale: Tensor? = null, vScale: Tensor? = null)`: the `scaled_dot_product_attention_varlen` operator. Variable-length (packed) scaled dot-product attention: ragged batches ride one token-packed tensor plus prefix-sum offsets, no padding. Same math as `scaled_dot_product_attention`; the batch structure moves into `cu_seqlens_*`.