When working with autograd, you should always use Variables and so never use the .data field. This is why there was an error in save_for_backward: because the indices were not a Variable.
The second error you get is because inds requires gradients (because some elements before in the gradient have learnable parameters and thus require gradients to update), but the gather function cannot provide gradients wrt the indices.
You can call .detach() on the inds Variable to detach it from it’s history such that it does not require gradients anymore. Note that when doing that, no gradients will be backpropagated by this Variable.