MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / forward

Method forward

tools/test_linear_probing_hf.py:119–130  ·  view source on GitHub ↗

Extract intermediate layer features. Returns: List of (patch_tokens, cls_token) tuples for each requested layer

(self, images: torch.Tensor)

Source from the content-addressed store, hash-verified

117 self.autocast_dtype = autocast_dtype
118
119 def forward(self, images: torch.Tensor) -> List[Tuple[torch.Tensor, torch.Tensor]]:
120 """Extract intermediate layer features.
121
122 Returns:
123 List of (patch_tokens, cls_token) tuples for each requested layer
124 """
125 with torch.inference_mode():
126 with torch.amp.autocast(device_type='cuda', dtype=self.autocast_dtype):
127 features = self.model.get_intermediate_layers_feature(
128 images, n=self.n_last_blocks, return_class_token=True
129 )
130 return features
131
132
133# ============================================================================

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected