(self, input_len)
| 74 | self.pos_enc.weight = nn.Parameter(torch.from_numpy(pos_enc), requires_grad=False) |
| 75 | self.max_len = int(max_seq_len/10) |
| 76 | def forward(self, input_len): |
| 77 | max_len = self.max_len # torch.max(input_len) |
| 78 | tensor = torch.cuda.LongTensor if input_len.is_cuda else torch.LongTensor |
| 79 | input_pos = tensor([list(range(1, len+1)) + [0]*(max_len-len) for len in input_len]) |
| 80 | return self.pos_enc(input_pos) |
nothing calls this directly
no outgoing calls
no test coverage detected