Iterating over dataloader: not enough values to unpack

loop = tqdm(loader[0], leave=True)

for batch_idx, (real,_) in enumerate(loop):

    real =

    cur_batch_size = real.shape[0]

When i iterate over dataloader the output is

My total items are 49190

loader = DataLoader(







it = iter(loader)

first = next(it)

second = next(it)



torch.Size([64, 1, 64, 64])
torch.Size([64, 1, 64, 64])

If iter(loader) only gives you a single tensor back, can you see if only unpacking a single variable fixes this issue? (e.g., for batch_idx, real in enumerate(loop):)

During a multiple value assignment, the ValueError: not enough values to unpack occurs when either you have fewer objects to assign than variables, or you have more variables than objects. This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error happened mostly in the case of using python split function. Verify the assignment variables. If the number of assignment variables is greater than the total number of variables, delete the excess variable from the assignment operator. The number of objects returned, as well as the number of variables available are the same.

To see what line is causing the issue, you could add some debug statements like this:

if len(line.split()) != "xx":
    print line

This will resolve the value error.