Trying to follow RNN example in C++

I am trying to follow NLP From Scratch: Classifying Names with a Character-Level RNN in C++.
First, I would like to know why no optimizer is used like Adam()? Also, why do we do the following for-loop to add the grad manually?

 for (auto const & p : model_to_train.parameters()) { , -k_learning_rate_);

Since this loops throws me the error: cannot call variable_data() on undefined tensor (variable_data at ..\..\torch\csrc\autograd\variable.cpp:262)