def next(self):
        if self.len_unique_copy == []:
            return -1, -1, -1 # epoch is done

        i = randint(0, 1-len(self.len_unique_copy))
        len_i = self.len_unique_copy[i] # current len
        ind_i = self.len2ind[len_i] # index of first not read caption of that len

        cap_i = self.len2cap[len_i][ind_i:ind_i+self.batch_size]
        im_i = []
        for curr_cap_i in cap_i:
            im_i.append(self.cap2im[curr_cap_i])

        self.len2ind[len_i] = self.len2ind[len_i] + self.batch_size
        if self.len2ind[len_i] > self.len2cap[len_i].shape[0]:#len(self.len2cap[len_i]):
            del self.len_unique_copy[i]
        
        return np.int32(np.array(cap_i)), np.int32(np.array(im_i)), np.int32(len_i)
dataset/ETHPy150Open emansim/text2image/coco/homogeneous-data.py/HomogeneousData.next/swapped operands of `-`