"attaching an optimizer" to the model

I am quite new to pytorch and I am looking at this piece of code:

I see that the author does this (see in In[30] for example):

# Attach the optimizer
model.optimizer = optimizer

What is the point of doing this? The examples shown on PyTorch’s website for training, never uses this attaching concept.

Am perplexed as to why one needs this. Any pointers would be useful…