Hi all,
This year I got introduced to neural networks and machine learning in Uni, and now I want to create a bot for a game this summer. The game is called Awale, and it is fairly simple. All you have to do is choose one out of six cups every turn, and your opponent does the same. Under some circumstances you win some points, and the player with the most points in the end wins the game.
So I wanted to make a Deep Q-learning agent for this. I have built something like this before, for an assignment, but I thought the assignment was a bit oversimplified and I wanted a bit more of a challenge. I have built the architecture for the game, and i am now almost ready to train my agents. The only thing I am doubting, and I hope you can help me with this, is the following.
Every turn in the game, I have to do a forward pass three times (once for me, once for the opponent, and once again for me), while I only want to calculate the loss for the first forward pass. I understand that a call to with torch.nograd() i can do forward passes without autograd doing calculations in the background, so I had the idea to surround the second and third forward pass in the  nograd(), but is this the best way to go here?
I hope you can help me understand,
Stijn
Edited for clarity