Hello, everyone. I need to use the neural network in an unconventional way, in which I have to compute the gradient of the model output with respect to the input, but I always get a None.
My code is like this:
model = torch.load('totalmodel.pth')
x = torch.tensor([1.,2.,3.,4.],device=device,requires_grad=True)
y = model(x)