Oh I see. I only looked at the code you provided from the tutorials to address your question

However, I don’t understand why the loss and the accuracy are restarted every epoch.

It’s important to restart e.g., the accuracy as well because you are interested in the accuracy over the training dataset, not e.g., the average accuracy 3 times over the training dataset.
However, based on your code, you probably wonder why we don’t save the accuracy in a list or something like that when you asked

Don’t we want to see how it has been evolving during the entire training process?

Of course you can do that like you have done in the code. It’s just a matter of what you do with it later. Sometimes you maybe want to create additional plots or analyze the training rate in other ways. However, in many cases it’s sufficient to just print the loss and accuracy “live” during the training, as it is done for the tutorials in the docs. I think the key here is to keep the code short and minimalistic to focus on the core ideas of the tutorials.