def METHOD_NAME(rank):
    for _ in range(10):
        num_indices = random.randint(20, 50)
        indices = torch.LongTensor(num_indices).random_(0, NUM_EMBEDDINGS)
        # Generate offsets.
        offsets = []
        start = 0
        batch_size = 0
        while start < num_indices:
            offsets.append(start)
            start += random.randint(1, 10)
            batch_size += 1
        offsets_tensor = torch.LongTensor(offsets)
        target = torch.LongTensor(batch_size).random_(8).cuda(rank)
        yield indices, offsets_tensor, target