Which way should I use to loop model using K-fold Cross Validation

Hi! I’m performing K-fold cross validation on inception v3 model and I’m a little confused about how to loop train, val and test modes in the model. Bellow I’ve written some pseudocode to show the two options that I’ve tried. In Option A train and validation are performed for every epoch in every fold. In Option B validation is perform for every fold.

Option A

for fold in folds:
    for epoch in epochs:
        train
        val
# Load best model
test

Option B

for fold in folds: 
    for epoch in epochs:
        train
    val
# Load best model
test

The model gets better results on validation set with option B. ¿Is there a correct/better way?

Thanks for the help!