The easiest way is to call your evaluation every x steps:
steps = 4000
for batch_idx, (data, target) in enumerate(train_loader):
# your training routine
if batch_idx % steps == 0:
# your evaluation routine
The easiest way is to call your evaluation every x steps:
steps = 4000
for batch_idx, (data, target) in enumerate(train_loader):
# your training routine
if batch_idx % steps == 0:
# your evaluation routine