MCPcopy Create free account
hub / github.com/THUNLP-MT/MEAN / forward

Method forward

evaluation/ddg/models/common.py:35–44  ·  view source on GitHub ↗

Args: x: (..., d).

(self, x)

Source from the content-addressed store, hash-verified

33 return in_dim * (2 * self.num_funcs + 1)
34
35 def forward(self, x):
36 """
37 Args:
38 x: (..., d).
39 """
40 shape = list(x.shape[:-1]) + [-1]
41 x = x.unsqueeze(-1) # (..., d, 1)
42 code = torch.cat([x, torch.sin(x * self.freq_bands), torch.cos(x * self.freq_bands)], dim=-1) # (..., d, 2f+1)
43 code = code.reshape(shape)
44 return code
45
46
47

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected