Contiguous grad for non contiguous tensor

Given a non-contiguous.tensor a
If I calculate

torch.autograd.bakwards([a], [contiguous_grad_of_a])

Is this OK?

This also makes me wonder: in case it does a clone, is calling tensor.contiguous() blocking?

Yes this is ok to do. The Tensor and its gradient doesn’t need to have the same contiguity.

is calling tensor.contiguous() blocking?

What do you mean by blocking?
It is a differentiable op, so gradients will flow back through it as expected.

A command is non-blocking - if commands following it can run before it finishes.

(I solved my problem, but still interested to know)

Ops in general are blocking.
Only when you use cuda that the underlying API is actually asynchronous.