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

Method forward

vtp/models/vtp.py:323–338  ·  view source on GitHub ↗
(
        self,
        image: Optional[torch.Tensor] = None,
        text: Optional[torch.Tensor] = None,
        ssl_dict: Optional[dict] = None,
        reconstruction_image: Optional[torch.Tensor] = None,
        forward_type: str = "clip",
    )

Source from the content-addressed store, hash-verified

321 return image_logits, text_logits
322
323 def forward(
324 self,
325 image: Optional[torch.Tensor] = None,
326 text: Optional[torch.Tensor] = None,
327 ssl_dict: Optional[dict] = None,
328 reconstruction_image: Optional[torch.Tensor] = None,
329 forward_type: str = "clip",
330 ):
331 assert forward_type in ["clip", "ssl", "rec"], "Invalid forward type"
332
333 if forward_type == "clip":
334 return self.forward_clip(image, text)
335 elif forward_type == "ssl":
336 return self.forward_ssl_learning(**ssl_dict)
337 elif forward_type == "rec":
338 return self.forward_reconstruction(reconstruction_image)
339
340 def forward_clip(
341 self,

Callers

nothing calls this directly

Calls 3

forward_clipMethod · 0.95
forward_ssl_learningMethod · 0.95

Tested by

no test coverage detected