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

LogitsPostprocessMixin

LogitsPostprocessMixin​

class max.nn.transformer.LogitsPostprocessMixin

source

Bases: object

Mixin providing logits postprocessing for single-device models.

Subclasses must define norm, lm_head, and return_logits. The return_hidden_states and logits_scaling attributes are optional and have defaults.

lm_head​

lm_head: Callable[[TensorValue], TensorValue]

source

The language model head projection.

logits_scaling​

logits_scaling: float = 1.0

source

A divisor applied to logits after projection. Logits are divided by this value before returning. Defaults to 1.0 (no scaling).

norm​

norm: Callable[[TensorValue], TensorValue]

source

The normalization function applied before the language model head.

return_hidden_states​

return_hidden_states: ReturnHiddenStates = 'none'

source

Which hidden states to return. Defaults to ReturnHiddenStates.NONE.

return_logits​

return_logits: ReturnLogits

source

Which logits to return.