num_batches * batch_size = num_samples would only be true, if each batch is full.
Otherwise the last batch might be smaller. 
PS: if you want to get rid of the last potentially smaller batch, you can specify drop_last=True in your DataLoader.