Hi, @albanD, sorry for pestering you for so long, but I didn’t understand how to do the following:

How does one detach so that it modifies the original Tensor as well and not just the view?

I am talking specifically about the code snippet I have written:
# some code
...
...
data_loader.tensors[0][idx_last_k1, :].detach_()
...
...
# some code

How do I detach those particular Tensors selected by idx_last_k1specifically because as per what you said, with this code, I am only detaching the temporary views in-place and not the original Tensors. The reason why I am asking this is that I still need to be able to understand and do this even if I were to use packages for higher-order derivatives (such as higher) for computing things like  .