Question about the CPU memory during inference

After used the interpolate ,the gpu memory can not be released during inference。I try to use torch.cuda.empty_cache() after, but it can work only in feding the images one by one。when the images is concurrently fedding ,the GPU still increase。Can you tell me how to do?

is there anyone can help me ? i also have use torch.no_gard() and model.eval()

I install pytorch1.3 with cuda10, but run with cuda9.0. Is this will lead the problem?

If you install the binaries with a cudatoolkit, your local CUDA installation won’t be used.
In case your memory increases, make sure to not store any tensors, which are still attached to the computation graph.
This could usually happen, if you are storing the outputs, predictions, or the loss in a list.

To release the device memory, you would need to delete the object (del x) and can clear the cache afterwards.

1 Like

I store the predictions in list, I have tried use del x ,but nothing happend。

Can you tell me how to maksure no tensors stored?

Can u try deleting both the inputs, outputs, and predictions, then use torch.cuda.empty_cache()?
A way to make sure that no useless tensors are stored is to declare the variables in the minimum scope possible and check all the global variables.

I just run the code of RDSNet based on mmdetection, almost all variables are local variables。