(self, sents, batch_size, pad_id=0, cuda=False, volatile=False)
| 90 | |
| 91 | class BatchSentLoader(object): |
| 92 | def __init__(self, sents, batch_size, pad_id=0, cuda=False, volatile=False): |
| 93 | self.sents = sents |
| 94 | self.batch_size = batch_size |
| 95 | self.sort_sents = sorted(sents, key=lambda x: x.size(0)) |
| 96 | self.cuda = cuda |
| 97 | self.volatile = volatile |
| 98 | self.pad_id = pad_id |
| 99 | |
| 100 | def __next__(self): |
| 101 | if self.idx >= len(self.sort_sents): |
nothing calls this directly
no outgoing calls
no test coverage detected