(self, d, T=730, repeat=None, offset=0)
| 4 | |
| 5 | class PositionalEncoder(nn.Module): |
| 6 | def __init__(self, d, T=730, repeat=None, offset=0): |
| 7 | super(PositionalEncoder, self).__init__() |
| 8 | self.d = d |
| 9 | self.T = T |
| 10 | self.repeat = repeat |
| 11 | self.denom = torch.pow( |
| 12 | T, 2 * torch.div(torch.arange(offset, offset + d).float(), 2, rounding_mode='floor') / (d+offset) |
| 13 | ) |
| 14 | self.updated_location = False |
| 15 | |
| 16 | def forward(self, batch_positions): |
| 17 | if not self.updated_location: |
nothing calls this directly
no outgoing calls
no test coverage detected