Get an initial state for decoding. Args: x (torch.Tensor): The encoded feature tensor Returns: decode result
(self, x: torch.Tensor)
| 293 | |
| 294 | |
| 295 | def decode(self, x: torch.Tensor): |
| 296 | """Get an initial state for decoding. |
| 297 | |
| 298 | Args: |
| 299 | x (torch.Tensor): The encoded feature tensor |
| 300 | |
| 301 | Returns: decode result |
| 302 | |
| 303 | """ |
| 304 | |
| 305 | raw_logp = self.ctc.softmax(x.unsqueeze(0)).detach().squeeze(0).cpu() |
| 306 | xlen = torch.tensor([raw_logp.size(1)]) |
| 307 | |
| 308 | return self._decode_inside(raw_logp, xlen) |