Well why do something like  this:

for epoch in range(total_epochs):
    current_model = train()
    ypred_valid = torch.sigmoid(model(valid_images))
    if epoch == 8 or epoch ==9 or epoch 10:
        print(ypred_valid)

Sorry, if this is not the solution you were looking for, but does this not solve your use case?