(self, ids, strip_eos=False, strip_padding=False)
| 172 | return ret[::-1] if self._reverse else ret |
| 173 | |
| 174 | def decode(self, ids, strip_eos=False, strip_padding=False): |
| 175 | if strip_padding and self.pad() in list(ids): |
| 176 | pad_pos = list(ids).index(self.pad()) |
| 177 | ids = ids[:pad_pos] |
| 178 | if strip_eos and self.eos() in list(ids): |
| 179 | eos_pos = list(ids).index(self.eos()) |
| 180 | ids = ids[:eos_pos] |
| 181 | return " ".join(self.decode_list(ids)) |
| 182 | |
| 183 | def decode_list(self, ids): |
| 184 | seq = reversed(ids) if self._reverse else ids |
nothing calls this directly
no test coverage detected