IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

MHAMaskVariant

MHAMaskVariant​

class max.nn.attention.MHAMaskVariant(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

source

Bases: str, Enum

Defines the integer mask variant codes used by multihead attention kernels.

CAUSAL_MASK​

CAUSAL_MASK = '0'

source

Causal masking; each position attends only to itself and earlier positions.

CHUNKED_CAUSAL_MASK​

CHUNKED_CAUSAL_MASK = '3'

source

Causal masking applied over fixed-size chunks of the sequence.

NULL_MASK​

NULL_MASK = '2'

source

No masking; every position attends to every position.

SLIDING_WINDOW_CAUSAL_MASK​

SLIDING_WINDOW_CAUSAL_MASK = '4'

source

Each position attends to itself and the previous window_size - 1 positions.

SLIDING_WINDOW_NONCAUSAL_MASK​

SLIDING_WINDOW_NONCAUSAL_MASK = '5'

source

Each position attends to itself, the previous window_size - 1 positions, and every later position.