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
ReturnHiddenStates
ReturnHiddenStates
class max.nn.ReturnHiddenStates(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Which hidden states a transformer model returns per sequence.
NONE returns none, LAST returns the final token’s hidden
states, and ALL returns every token’s. See each member’s
description for the other modes.
ALL
ALL = 'all'
Return every token’s hidden states.
ALL_NORMALIZED
ALL_NORMALIZED = 'all_normalized'
Return every token’s hidden states after the model’s final norm.
LAST
LAST = 'last'
Return the final token’s hidden states.
LAST_PER_DEVICE
LAST_PER_DEVICE = 'last_per_device'
Return the final token’s hidden states as per-device tensors, one per device, without collapsing identical replicas.
NONE
NONE = 'none'
Return no hidden states.
SELECTED_LAYERS
SELECTED_LAYERS = 'selected_layers'
Return hidden states captured at specific layer indices.