I encountered an exception in KernelFuntion.h file when trying to pass the output from the target Network to calculate loss, and i would like to know what i am missing here, like can’t i just pass the value in the target argument of the loss function? like this:
torch::Tensor targetQvalues = targetNet->forward(input);

policyNet->zero_grad();
torch::Tensor loss = torch::mse_loss(currentQValues, targetQvalues);