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

Method forward

vtp/models/layers/embeddings.py:61–70  ·  view source on GitHub ↗
(self, x: Tensor)

Source from the content-addressed store, hash-verified

59 self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
60
61 def forward(self, x: Tensor) -> Tensor:
62 _, _, H, W = x.shape
63
64 x = self.proj(x) # B C H W
65 H, W = x.size(2), x.size(3)
66 x = x.flatten(2).transpose(1, 2) # B HW C
67 x = self.norm(x)
68 if not self.flatten_embedding:
69 x = x.reshape(-1, H, W, self.embed_dim) # B H W C
70 return x
71
72 def flops(self) -> float:
73 Ho, Wo = self.patches_resolution

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected