@DiffEverything By default the requires_grad is False:
import torch
a = torch.autograd.Variable(torch.Tensor(10,10))
print(a.requires_grad) # prints False

@ckanbak if what you’re looking for is how the input should vary to increase its score for a given digit, then yes, you should wrap the input in a Variable with requires_grad=True and then use what you proposed (note that you may want to convert the list into a Tensor with torch.Tensor([0,0,0,1,0,...,0])).
You can also, given the size 10 vector output and the index of the digit you’re looking for do: current_score = output[selected_digit] and then current_score.backward().