def __next__(self):
    if (self.batch_count == self.max_count):
        self.batch_count = 0
        raise StopIteration()
    test_batch = {}
    for (idx, loader_iter) in enumerate(self.loader_iters):
        try:
            batch = loader_iter.__next__()
        except StopIteration:
            new_loader_iter = iter(self.my_loader.loaders[idx])
            self.loader_iters[idx] = new_loader_iter
            batch = new_loader_iter.__next__()
        test_batch = self.batchify_data(batch, test_batch)
    inputs = {}
    for (k, v) in test_batch.items():
        if (k not in ['labels']):
            inputs[k] = v.detach().to(self.my_loader.args.device)
    with torch.no_grad():
        model.select_batch_mode = True
        outputs = model(**inputs)
        model.select_batch_mode = False
    (test_batch_entropy, test_batch_entropy_mean, max_mean_batch_entropy) = outputs[(- 3):]
    for (_, v) in inputs.items():
        del v
    del inputs
    test_batch_entropy_mean = (test_batch_entropy_mean / max_mean_batch_entropy)
    test_batch_entropy = (test_batch_entropy * test_batch_entropy_mean)
    select_size = min(self.my_loader.args.train_batch_size, test_batch['input_ids'].shape[0])
    top_entropy = torch.topk(test_batch_entropy, select_size)
    for (k, v) in test_batch.items():
        test_batch[k] = torch.index_select(v, 0, top_entropy.indices)
    self.batch_count += 1
    return test_batch
def __next__(self):
    if (self.batch_count == self.max_count):
        self.batch_count = 0
        raise StopIteration()
    test_batch = {}
    for (idx, loader_iter) in enumerate(self.loader_iters):
        try:
            batch = loader_iter.__next__()
        except StopIteration:
            new_loader_iter = iter(self.my_loader.loaders[idx])
            self.loader_iters[idx] = new_loader_iter
            batch = new_loader_iter.__next__()
        test_batch = self.batchify_data(batch, test_batch)
    inputs = {}
    for (k, v) in test_batch.items():
        if (k not in ['labels']):
            inputs[k] = v.detach().to(self.my_loader.args.device)
    with torch.no_grad():
        model.select_batch_mode = True
        outputs = model(**inputs)
        model.select_batch_mode = False
    (test_batch_entropy, test_batch_entropy_mean, max_mean_batch_entropy) = outputs[(- 3):]
    for (_, v) in inputs.items():
        del v
    del inputs
    test_batch_entropy_mean = (test_batch_entropy_mean / max_mean_batch_entropy)
    test_batch_entropy = (test_batch_entropy * test_batch_entropy_mean)
    select_size = min(self.my_loader.args.train_batch_size, test_batch['input_ids'].shape[0])
    top_entropy = torch.topk(test_batch_entropy, select_size)
    for (k, v) in test_batch.items():
        test_batch[k] = torch.index_select(v, 0, top_entropy.indices)
    self.batch_count += 1
    return test_batch