I assume feature is a list holding all tensors?
If that’s the case, you would have enough memory to at least store the data once.
Could you try to create a feature tensor in the first place instead of a list?
If you are working close to the memory limit, the memory peaks might yield an OOM error.
That being said, if you don’t need gradients for the calculation, you could wrap the code in a with torch.no_grad() block.