In the validation (and training) step the data batch is obtained from the validation DataLoader (which is defined with the option shuffle=False) as:
for batch_idx in progress_bar:
data = next(iter(val_loader)).to(device)
At each iteration in the loop a new iterator iter(val_loader) is initialized and next() is called on it, returning always the first batch of the unshuffled val_loader DataLoader. I believe this might be an unintended behaviour.
The same applies also to the training step, where an iterator object is re-initialized at each iteration of the loop through the batches, however its impact is less noticeable since the training DataLoader is shuffled (shuffle=True) in the example.
This can be fixed, for example, simply by defining the iterator outside the loop through the batches.
Tell us what happened?
This is about the PointNet++ example.
In the validation (and training) step the data batch is obtained from the validation DataLoader (which is defined with the option
shuffle=False
) as:At each iteration in the loop a new iterator
iter(val_loader)
is initialized andnext()
is called on it, returning always the first batch of the unshuffledval_loader
DataLoader. I believe this might be an unintended behaviour.The same applies also to the training step, where an iterator object is re-initialized at each iteration of the loop through the batches, however its impact is less noticeable since the training DataLoader is shuffled (
shuffle=True
) in the example.This can be fixed, for example, simply by defining the iterator outside the loop through the batches.