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
AttentionMaskVariant
AttentionMaskVariant
class max.nn.attention.AttentionMaskVariant(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Defines the string mask variant identifiers used in attention configuration.
CAUSAL_MASK
CAUSAL_MASK = 'causal'
Causal masking; each position attends only to itself and earlier positions.
CHUNKED_CAUSAL_MASK
CHUNKED_CAUSAL_MASK = 'chunked_causal'
Causal masking applied over fixed-size chunks of the sequence.
NULL_MASK
NULL_MASK = 'null'
No masking; every position attends to every position.
SLIDING_WINDOW_CAUSAL_MASK
SLIDING_WINDOW_CAUSAL_MASK = 'sliding_window_causal'
Each position attends to itself and the previous window_size - 1
positions.
SLIDING_WINDOW_NONCAUSAL_MASK
SLIDING_WINDOW_NONCAUSAL_MASK = 'sliding_window_noncausal'
Each position attends to itself, the previous window_size - 1
positions, and every later position.
TENSOR_MASK
TENSOR_MASK = 'tensor_mask'
An explicit mask tensor supplied by the caller.