Hello,
I am trying to train my model and my code is listed below:
import torch.nn.functional as F

data = Variable(data,requires_grad=True)
optimizer.zero_grad()
output = model(data)
predict = F.softmax(output,0)
final_predict = 1.2 * predict[0] + 1.3 * predict[1] + 2.5 * predict[2]
loss = F.mse_loss(final_predict, ground_truth)
loss.backward()

print(predict.grad)

However, the parameters of my model remain the same and the gradient is none.
So, how to solve this issue? Thanks.