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

Method forward

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

Source from the content-addressed store, hash-verified

15 self.embedding_dim = 3
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 * cos_lat, sin_lon * cos_lat, sin_lat), 1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected