Making the Tensor contiguous won’t work for sure as it would break inplace ops.
Adding a check for .is_contiguous() and raise an error if it is not might be overly strict as you can sometimes do the view even when it is not contiguous.

it arises from pytorch back-propagation internals.

It does not actually happens in the backprop internal but in the lbfgs optimizer.
That being said, we might be able to catch this error and improve the error message?
Also @ptrblck note that the error is from the .grad field no here?