---
title: "scaledDotProductAttention(query:key:value:scale:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/scaleddotproductattention(query:key:value:scale:name:)"
---

# scaledDotProductAttention(query:key:value:scale:name:)

Creates a scaled dot product attention (SDPA) operation (without a mask) and returns the result tensor.

## Declaration

```swift
func scaledDotProductAttention(query queryTensor: MPSGraphTensor, key keyTensor: MPSGraphTensor, value valueTensor: MPSGraphTensor, scale: Float, name: String?) -> MPSGraphTensor
```

## Parameters

- `queryTensor`: A tensor that represents the query projection.
- `keyTensor`: A tensor that represents the key projection.
- `valueTensor`: A tensor that represents the value projection.
- `scale`: A scale that is applied on the result of query and value matrix multiply.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object.
