Skip to content

Token Grouping

Task-independent token grouping utilities. GPSTokenGrouper produces grouped features and a TokenGroupingResult; discrete index coding is documented separately under index codecs. See the reference software guide for integration with CommonFeatureCodecModel and the reserved post-processing interface.

cofai.token_grouping

Task-independent token grouping utilities.

GPSTokenGrouper

GPSTokenGrouper(max_iter: int = 10, beta: float = 0.1, eps: float = 0.001)

Select patch tokens using attention propagation from the class token.

TokenGroupingResult dataclass

TokenGroupingResult(tokens: Tensor, kept_indices: Tensor)

Output of one grouping operation.