Thanks for the update!
I’m not sure, if the self.que usage is really the culprit here and think that you are increasing the memory by reusing x in the first example.
        while t<=1000:
            x = self.fc(x)

This code snippet will pass the output as the new input to the model, so that intermediate activations cannot be freed. The storage in self.que might be irrelevant here. Even if you append and pop it properly, the model itself would still hold references to the “old” input and PyTorch won’t free the graph.