Hi, I wonder if there is any method to do in-place indexing to “crop” the tensor without extra memory cost.
For example, I have a tensor x = torch.rand(2,3,4, device=“cuda”), when we index x = x[:,:,0::2], in my opinion, we only return a view of the original data, and the memory cost is still O(2x3x4).
tensor.resize_() seems to be an in-place method, but it is not an indexing operation.
Could you help me? Thank you.
If you can discuss the situation, when x requires grad and not, it would be better.