Hi everyone,
I’m trying to use a custom loss function which is something like:
torch.dist(torch.argmin(predictedData).double(), actualData, p=2)
loss.backward()
This function outputs a tensor with requires_grad = False and therefore when I try to backprop I get:
RuntimeError(‘element 0 of tensors does not require grad and does not have a grad_fn’
*I think it’s because torch.argmin() output has requires_grad = False as well
Does anyone knows how can I fix this issue?