I think I had the same confusion as the OP. Basically, I thought the slicing operation didn’t compute gradients, but x.grad (in the OP’s example) was None because intermediate variables don’t store gradients and not because slicing doesn’t compute gradients.