import torch
from torch.autograd import Variable
import torchvision.models

model=torchvision.models.squeezenet1_1(pretrained=True)

x=torch.randn(1,3,100,100)
target_y=6

x_fooling=x.clone()
x_fooling=x_fooling.requires_grad_()

while(torch.argmax(model(x_fooling).squeeze())!=target_y):
    
    l=model(x_fooling)[0][target_y]
    l.backward()

    dx=1*x_fooling.grad/x_fooling.grad.norm()
    
    x_fooling=x_fooling+dx

How x_fooling.grad is NoneType here? It is not even leaf node, why?