MCPcopy Create free account
hub / github.com/Anoise/WTFlib / forward

Method forward

LDPS_Graph/layers/Transformer_EncDec.py:96–112  ·  view source on GitHub ↗
(self, x, cross, x_mask=None, cross_mask=None)

Source from the content-addressed store, hash-verified

94 self.activation = F.relu if activation == "relu" else F.gelu
95
96 def forward(self, x, cross, x_mask=None, cross_mask=None):
97 x = x + self.dropout(self.self_attention(
98 x, x, x,
99 attn_mask=x_mask
100 )[0])
101 x = self.norm1(x)
102
103 x = x + self.dropout(self.cross_attention(
104 x, cross, cross,
105 attn_mask=cross_mask
106 )[0])
107
108 y = x = self.norm2(x)
109 y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1))))
110 y = self.dropout(self.conv2(y).transpose(-1, 1))
111
112 return self.norm3(x + y)
113
114
115class Decoder(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected