spadel:

net(torch.tensor(state).float().view(-1, 9)).squeeze().detach()


You have detached the output of your network.
Besides, DQN is usually not implemented in this way, the network would accept a state s and output q values for all actions.
Maybe read this tutorial 6