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

Method forward

model/backbone.py:669–676  ·  view source on GitHub ↗
(self, x, l, l_mask)

Source from the content-addressed store, hash-verified

667 )
668
669 def forward(self, x, l, l_mask):
670 vis = self.vis_project(x.permute(0, 2, 1)) # (B, dim, H*W)
671 lang = self.image_lang_att(x, l, l_mask) # (B, H*W, dim)
672 lang = lang.permute(0, 2, 1) # (B, dim, H*W)
673 mm = torch.mul(vis, lang)
674 mm = self.project_mm(mm) # (B, dim, H*W)
675 mm = mm.permute(0, 2, 1) # (B, H*W, dim)
676 return mm
677
678class SpatialImageLanguageAttention(nn.Module):
679 def __init__(self, v_in_channels, l_in_channels, key_channels, value_channels, out_channels=None, num_heads=1):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected