# multi\_head\_attention

````
    description: 'layer multi_head_attention for configurable component'
    ---

    # multi_head_attention layer

    Adds an attention layer with multiple heads. Uses softmax. Ends in a linear

    ## required arguments

        `size` - output size

    ## optional arguments

        `heads` - Number of heads to use. Defaults to 4

    ## input size

    Any 2-d tensor

    ## output size

    First argument

    ## syntax

    ```json
      "ez_norm CHANNELS heads=HEADS"
    ```

    ## examples

    ```json
      "multi_head_attention 1024 heads=4"
    ```
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hypergan.gitbook.io/hypergan/components/layers/multi_head_attention.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
