inputs = Variable(inputs,requires_grad=False)
labels = Variable(labels,requires_grad=False)logits = model.forward(inputs)
outputs= loss.forward(softmax(logits).argmax(axis=1).float(),labels.float())
optimizer.zero_grad()
outputs.backward()
optimizer.step()
I have images as an input and corresponding binary labels to the CNN but I am facing the error as
RuntimeError: Expected isFloatingType(grads[i].scalar_type()) to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) (validate_outputs at …\torch\csrc\autograd\engine.cpp:476)
(no backtrace available)
I have used BCEloss function and Adam as optimizer. Used Softmax for the output of BCEloss
Any idea to fix it?