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

EncoderInputs

EncoderInputs​

class max.pipelines.lib.registration_encoder.EncoderInputs(*, tokens, attention_mask=None, input_row_offsets=None, return_n_logits=None)

source

Bases: Generic[TensorT]

The inputs of an ENCODER module’s __call__.

A field that is None is not a graph input: a padded encoder takes attention_mask, and a ragged one input_row_offsets and return_n_logits.

Parameters:

  • tokens (TensorT)
  • attention_mask (TensorT | None)
  • input_row_offsets (TensorT | None)
  • return_n_logits (TensorT | None)

attention_mask​

attention_mask: TensorT | None = None

source

1.0 for a real token and 0.0 for padding, [batch_size, seq_len], for a padded encoder.

input_row_offsets​

input_row_offsets: TensorT | None = None

source

Each sequence’s start in tokens, for a ragged encoder.

return_n_logits​

return_n_logits: TensorT | None = None

source

The ragged batch’s logit count, which an encoder ignores; the graph takes it so a ragged encoder’s inputs match a decoder’s.

tokens​

tokens: TensorT

source

The token IDs: [batch_size, seq_len] padded, or [total_seq_len] ragged.