Hi,
I am having some issues with a list of tensors:
My list is
features = [tensor(batch, dim1, dim2, etc.), ..., tensor(batch, dim1, dim2, etc.)]
I want to restrain it to some elements, so I do
keep = elements
features = [f[keep] for f in features]

I would expect same or less memory to be used but instead I see a spike in memory use. I am guessing there is a copy but I am not sure how to avoid it while still being able to save a list of tensors.
Edit: if it is relevant, this is on Pytorch 1.0 and it is GPU memory which spikes. I do other operations afterwards/before but commenting this line removes the memory overhead.