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

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

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

# scaledDotProductAttention

[common]\
fun [scaledDotProductAttention](scaledDotProductAttention.md)(query: [Tensor](../Tensor/index.md), key: [Tensor](../Tensor/index.md), value: [Tensor](../Tensor/index.md), 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)

`scaledDotProductAttention(query: Tensor, key: Tensor, value: Tensor, attnMask: Tensor? = null, isCausal: Boolean = false, qScale: Tensor? = null, kScale: Tensor? = null, vScale: Tensor? = null)`: the `scaled_dot_product_attention` operator. Scaled dot-product attention over dense head-major tensors. `s` defaults to (the q/k head size) and is replaced wholesale by `q_scale` when given. Layout is head-major, `D` innermost.