MCPcopy Create free account
hub / github.com/MarcCoru/locationencoder / forward

Method forward

locationencoder/pe/wrap.py:17–26  ·  view source on GitHub ↗
(self, coords)

Source from the content-addressed store, hash-verified

15 self.embedding_dim = 4
16
17 def forward(self, coords):
18 # place lon lat coordinates in a -pi, pi range
19 coords = torch.deg2rad(coords)
20
21 cos_lon = torch.cos(coords[:, 0]).unsqueeze(-1)
22 sin_lon = torch.sin(coords[:, 0]).unsqueeze(-1)
23 cos_lat = torch.cos(coords[:, 1]).unsqueeze(-1)
24 sin_lat = torch.sin(coords[:, 1]).unsqueeze(-1)
25
26 return torch.cat((cos_lon, sin_lon, cos_lat, sin_lat), 1)

Callers 5

MSE_lossFunction · 0.45
SLDS_lossFunction · 0.45
SSDL_lossFunction · 0.45
full_lossFunction · 0.45
AN_lossFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected