MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / forward

Method forward

models/ots.py:28–38  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

26 weight_init(layer)
27
28 def forward(self, x):
29 m_batchsize, C, length, _ = x.size()
30 proj_value = self.value_conv(x).view(m_batchsize, -1, length)
31 x = proj_value.view(m_batchsize, -1, length, 1)
32 proj_query = self.query_conv(x).view(m_batchsize, -1, length).permute(0, 2, 1)
33 proj_key = self.key_conv(x).view(m_batchsize, -1, length)
34 energy = torch.bmm(proj_query, proj_key)
35 attention = self.softmax(energy)
36 x = torch.bmm(proj_value, attention.permute(0, 2, 1))
37 x = torch.cat((self.gamma*x, proj_value), dim=1).view(m_batchsize, -1, length, 1)
38 return x
39
40
41class OAM_GRAM(Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected