pixel_bounds

Function pixel_bounds 

Source
pub fn pixel_bounds(
    vcfg: &VisionConfig,
    operator_max: Option<usize>,
) -> (u64, u64)
Expand description

2026-09-25: (min_pixels, max_pixels) for smart_resize, as pixel areas.

GLM states its budget in merged tokens (min_image_tokens, max_image_tokens), converted as tokens × factor²: one merged token covers one factor × factor pixel block. max_pixels is the least of:

  • the encoder’s capacity, from derive_max_patches, the function GlmVit sizes its buffers with;
  • the declared token budget, when nonzero;
  • operator_max, when given;

and never below one merged token. With no bound the encoder holds 6400 patches (FALLBACK_MAX_PATCHES), while GLM’s default budget of 8000 merged tokens is 32000 patches, so the encoder term binds.