I’ve been stuck here for a while now. Any help.
1 Like
The last batch given by your DataLoader
might be smaller, if the length of your Dataset
is not divisible by the batch size without a remainder.
Try to get the current batch size inside the training loop:
for data, target in testloader:
batch_size = data.size(0)
...
for i in range(batch_size):
...
2 Likes
I worked perfectly!!! Thank you!