MCPcopy Create free account
hub / github.com/ICTMCG/FakeSV / forward

Method forward

code/models/coattention.py:42–51  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

40 self.layer_norm = LayerNormalization(d_model)
41
42 def forward(self, inputs):
43 # inputs: [b_size x len_q x d_model]
44 residual = inputs
45 output = self.relu(self.conv1(inputs.transpose(1, 2)))
46
47 # outputs: [b_size x len_q x d_model]
48 output = self.conv2(output).transpose(1, 2)
49 output = self.dropout(output)
50
51 return self.layer_norm(residual + output)
52
53class MultiHeadAttention(nn.Module):
54 def __init__(self, d_k, d_v, n_heads, dropout, d_model, visual_len, sen_len, fea_v, fea_s, pos):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected