image_variable = Variable(transformedimageinput, requires_grad=True)
prediction = inceptionfeaturesmodel(image_variable)
prediction.backward(gradient=torch.ones( prediction.size()), retain_variables=True)

image_variable has a size [1, 3, 299, 299]
prediction has size [1, 1000]
After .backward() shouldn’t the image_variable.grad have size [1, 3, 299, 299, 1000] since it is essentially a Jacobian?
But it has same dimensions as input. ie [1, 3, 299, 299]