Not actually, this is just a way we train our deep learning models, where epochs represent how many times we are looking to our dataset. If you want to finish your training earlier then indeed you can set epochs to like 10, 5… etc. But again if you do so then your model might not be able to predict correctly with it’s full potential.
And even if training is slow, then it actually has nothing to do with double for loop. In that case your model would be big, or you are dealing massive datasets.
In case you want faster training you can always use gpu if available, by sending your model to vram using model = model.cuda() and doing same for inputs and targets as
inputs = batch[0].cuda()
targets = batch[1].cuda()

Feel free to ask for any further clarifications.