[Tensorflow2.12][C++]How do I input arg grad into ApplyAdam() to make Adam work?

I’m a new user of Tensorflow 2.12. I use C++ to implement my neural network, but I have not found relevant tutorials and sample codes, only very professional API introductions. But it is difficult for me to use, I asked ChatGPT, and found that many of the APIs it gives are abandoned I still need to correct it repeatedly.
At present, I am trying to use the Adam optimizer, but it is not as simple as before. It seems that it can only be constructed using ApplyAdam, but it requires a lot of parameters, one of which is called grad, and I don’t know how to calculate or how to get this grad. , and I have 1 hidden layer, 2 weights and 2 biases, I may need to write 4 optimizers, but this ApplyAdam can’t pass in the list, it can only be built one by one, but I really don’t know the last parameter know how to write.
Please give some suggestions or documents to help me, thank you!
My Task is use MLP to implement the classification of irises.
Here is my code: Ubuntu Pastebin