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
ImageMetadata
ImageMetadata
class max.pipelines.context.ImageMetadata(*, start_idx, end_idx, pixel_values, image_hash=None, num_embedding_rows=None)
Bases: object
Metadata about an image in the prompt.
Each image corresponds to a range in the text token array [start_idx, end_idx).
-
Parameters:
embedding_rows
property embedding_rows: int
Embedding rows for this entry (span width unless overridden).
end_idx
end_idx: int
One after the index of the last <vision_token_id> special token for the image
image_hash
Hash of the image, for use in prefix caching
num_embedding_rows
Embedding rows the encoder emits for this entry.
None means every token in [start_idx, end_idx) is a placeholder,
so the row count equals the span width. Set by tokenizers whose spans
interleave placeholder runs with other tokens (e.g. video timestamp
text).
pixel_values
Pixel values for the image.
Can be various dtypes depending on the vision model:
- float32: Original precision
- uint16: BFloat16 bits stored as uint16 (workaround for NumPy’s lack of native bfloat16 support). Reinterpreted as bfloat16 on GPU.
start_idx
start_idx: int
Index of the first <vision_token_id> special token for the image