MCPcopy Create free account
hub / github.com/PolymathicAI/AstroCLIP / forward

Method forward

astroclip/modules.py:47–56  ·  view source on GitHub ↗
(self, x: torch.tensor)

Source from the content-addressed store, hash-verified

45 self.dropout = nn.Dropout(dropout)
46
47 def forward(self, x: torch.tensor):
48 batch_size = x.shape[0]
49 attentions = self.multihead_attn(
50 query=self.query.repeat(batch_size, 1, 1),
51 key=x,
52 value=x,
53 average_attn_weights=False,
54 )[0]
55 x = self.layernorm(self.dropout(attentions))
56 return x, attentions[1]
57
58
59class MLP(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected