MCPcopy Create free account
hub / github.com/Xuehao-Gao/GUESS / forward

Method forward

mld/models/operator/position_encoding_layer.py:24–30  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

22 self.register_buffer("pe", pe)
23
24 def forward(self, x):
25 # not used in the final model
26 if self.batch_first:
27 x = x + self.pe.permute(1, 0, 2)[:, : x.shape[1], :]
28 else:
29 x = x + self.pe[: x.shape[0], :]
30 return self.dropout(x)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected