def next()

in hype/adjacency_matrix_dataset.pyx [0:0]


    def next(self):
        '''
        Python visible function for indexing the dataset.  This first
        allocates a tensor, and then modifies it in place with `_getitem`

        Args:
            idx (int): index into the dataset
        '''
        size = self.queue.qsize()
        if size == 0 and self.join_count == len(self.threads):
            # No more items in queue and we've joined with all worker threads
            raise StopIteration

        item = self.queue.get()
        if isinstance(item, int):
            self.join_count += 1
            self.threads[item].join()  # Thread `item` is finished, join with it...
            return self.next()  # try again...
        self.qsize += size
        self.qsamples += 1
        prevmisses = self.qmisses
        self.qmisses += 1 if size == 0 else 0
        if self.qmisses == 20 and prevmisses == 19:
            print('Warning: not enough threads to keep up with training loop!')
        return item