C++ manual element-wise slicing

Hey guys, just wanted to check that the following kind of assignment will retain the gradients/autograd graph properly:

torch::Tensor t = torch::zeros({4,1}, torch::dtype(torch::kFloat32).requires_grad(false));

t.index({0,0}) = ot.index({start_index});
t.index({1,0}) = ot.index({start_index+1});
t.index({2,0}) = ot.index({start_index+2});
t.index({3,0}) = 0;

Thanks!