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 function

distributed_logits_postprocess

distributed_logits_postprocess()​

max.nn.transformer.distributed_logits_postprocess(h, input_row_offsets, return_n_logits, lm_head, signal_buffers, return_logits, device, norm_shards=None, return_hidden_states=ReturnHiddenStates.NONE, logits_scaling=1.0, logit_softcapping=None, capture_hidden_states=None)

source

Common logits postprocessing for multi-device sharded models.

Handles last-token gathering, logits computation (VARIABLE/ALL/LAST_TOKEN), logits scaling, and hidden states return for models that use per-device sharded hidden states.

Parameters:

Returns:

Tuple of (last_logits, [logits, offsets], [hidden_states]).

Return type:

tuple[TensorValue, …]