X_fooling = X.clone()
X_fooling = X_fooling.requires_grad_()
learning_rate = 1
l=model(X_fooling).squeeze()[target_y].sum()
l.backward()
g=X_fooling.grad
#print(g.dtype)
dX=learning_rate*X_fooling.grad/X_fooling.grad.norm()
X_fooling=X_fooling+dX
#unsupported operand type(s) for *: ‘int’ and ‘NoneType’
here X_fooling.grad is NoneType. Why?
How to solve this?