| 38 | |
| 39 | |
| 40 | class GenerationSequence(object): |
| 41 | |
| 42 | def __init__(self, seq_idx, batch_idx): |
| 43 | self.seq_idx = seq_idx |
| 44 | self.batch_idx = batch_idx |
| 45 | |
| 46 | def get_batch_idx(self) -> int: |
| 47 | """ |
| 48 | Returns idx of sequence in batch |
| 49 | """ |
| 50 | return self.batch_idx |
| 51 | |
| 52 | def get_seq_idx(self) -> int: |
| 53 | """ |
| 54 | Returns sequence idx |
| 55 | """ |
| 56 | return self.seq_idx |
| 57 | |
| 58 | def __eq__(self, another): |
| 59 | return hasattr(another, 'seq_idx') and self.seq_idx == another.seq_idx and \ |
| 60 | hasattr(another, 'batch_idx') and self.batch_idx == another.batch_idx |
| 61 | |
| 62 | def __hash__(self): |
| 63 | return self.seq_idx |
| 64 | |
| 65 | |
| 66 | class BlocksManager(object): |
no outgoing calls