How can I get the gradient of a certain number of image out of multiple images with Pytorch? Instead of the gradient with all input images?
After I trained a deep neural network (DNN) that takes 6 images as input, I want to evaluate the performance of the model by adding perturbation to the input images. In this case, using gradient of loss function with respect to the input images is an effective method to generate perturbation.