MCPcopy Create free account
hub / github.com/SooLab/CGFormer / forward

Method forward

model/layers.py:229–233  ·  view source on GitHub ↗
(self, tokens, text, pad_mask)

Source from the content-addressed store, hash-verified

227 self.normk = nn.LayerNorm(768)
228
229 def forward(self, tokens, text, pad_mask):
230 ltoken, ttoken = torch.split(tokens, [tokens.shape[1]-1,1], dim=1)
231 ttoken = ttoken + self.cross_attn(query=self.normq(ttoken), key=self.normk(text.permute(0,2,1)), mask=pad_mask[...,0])
232 tokens = torch.cat((ltoken, ttoken), dim=1)
233 return tokens
234
235class LoadLayer(nn.Module):
236 def __init__(self, token_dim, drop, bias=False, pe_shape=None) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected