The training batch size doesn’t matter, since you are using loader_test.
The loss calculation looks wrong:
loss_test_avg = losses_sum / num_samples_test
mean_loss_train = losses_sum / (
    len(loader_train) * loader_train.batch_size
)

I’m not sure which reduction you are using in the criterion, but based on the variable names I would assume reduction='sum'?
On the other hand, since you are dividing by num_samples_test (which is in fact the number of batches), you might be using the default reduction='mean'?
The mean_loss_train calculation doesn’t seem to be correct, since you are dividing the test loss by the number of samples.