Can anyone tell me, how should I test out model? should I test it with each epoch or should we test at the end? Lets Say,  here is our train and test function where we train and test the model.
def train(all required variables):
    for input, target in train_loader:
       out = net(input)
       loss = criterion(outputs, targets)
       loss.backward()
       optimizer.step()
       acc = Accuracy(out, target)

def test(all required variables):
    for input, target in train_loader:
       outputs = net(inputs)
        loss = criterion(outputs, targets)

        test_loss += loss.item()
        _, predicted = outputs.max(1)
        total += targets.size(0)
        correct += predicted.eq(targets).sum().item()
        acc = 100.*correct/total
        return acc

if __name__ == '__main__':
     for epoch in range(start_epoch, start_epoch+200):
         train(epoch)
         acc = test(epoch)
         
         if acc > best_acc:
            print('Saving..')
           state = {'net': net.state_dict(),'acc': acc,
                   'epoch': epoch}
         torch.save(state, './checkpoint/ckpt.pth')
         best_acc = acc

Here in the above code, we train the model with the training dataset with each epoch and we are testing it on test dataset on each epoch and then saving the best checkpoint based on the accuracy of test dataset.
This same thing is happening in following GitHub repo; I have implemented almost 10 research paper in past 13 days, and I have seen the same code pattern in the all 10 papers.

*

*https://github.com/winycg/HSAKD/blob/main/train_teacher_cifar.py


*https://github.com/kuangliu/pytorch-cifar/blob/master/main.py
I have implemented the above 1st one paper, it is also following the above same pattern, I have trained it for 240 epoch as the author suggested in the Readme file. I have followed the all steps he written there. He has submitted the 80.7% accuracy in his papers, to validate this accuracy I have trained it.
I have kept the model and all hyperparameter same, run it 5 times without any changes in the code and parameters.
1st attempt = 80.69%
2nd attempt = 80.22%
3rd attempt = 80.93%
4rth attempt = 80.31%
5th attempt = 80.91%
The average of all 5 attempts is 80.612%
why this accuracy is changing? If I have to submit it in my paper then how can I validate it?

The approach has some bias because the hyper-parameters (HPs) are tuned using the test set (no validation set seems to be around in the code). Yet, we may see it in some publications. So, it introduces some sort of data leakage. Be prepared to defend it if you want to go that way.
An alternative way would be using a separate validation set, tuning the HPs based on it and reporting the final result based on the test set.
Your accuracies are only slightly changing. I'd suggest presenting your results with mean +/- std, maybe with more attempts, e.g. 10 attempts. In this way, you also reflect the uncertainty associated with your trials.
