(self, x, x_lens)
| 11 | self.linear2 = nn.Linear(llm_dim, llm_dim) |
| 12 | |
| 13 | def forward(self, x, x_lens): |
| 14 | batch_size, seq_len, feat_dim = x.size() |
| 15 | num_frames_to_discard = seq_len % self.ds |
| 16 | if num_frames_to_discard > 0: |
| 17 | x = x[:, :-num_frames_to_discard, :] |
| 18 | seq_len = x.size(1) |
| 19 | |
| 20 | x = x.contiguous() |
| 21 | x = x.view( |
| 22 | batch_size, seq_len // self.ds, feat_dim * self.ds |
| 23 | ) |
| 24 | |
| 25 | x = self.linear1(x) |
| 26 | x = self.relu(x) |
| 27 | x = self.linear2(x) |
| 28 | |
| 29 | new_x_lens = torch.clamp(x_lens, max=seq_len) // self.ds |
| 30 | return x, new_x_lens |
nothing calls this directly
no outgoing calls
no test coverage detected