TensorFlow.NET icon indicating copy to clipboard operation
TensorFlow.NET copied to clipboard

Issue with clearing memory from GPU

Open Marevv opened this issue 3 years ago • 1 comments
trafficstars

Hello, like mention in topic after using a class that uses tensorflow library, memory on GPU isn't released. I tried to put whole process in using statement, clearing sessions etc. I am using tensorflow with keras to build face recognition tool. I added my class to IDisposable and cleared all fields that I am using, nothing helped. GC can't clear that, it looks like it's in unmanagement memory. It's only freed when I close the app. It fills up all the memory it can. I search all the example that are provided but I haven't seen one with clearing memory.

I think it might be python interpreter that is put there and not cleared after using. It's an Tensorflow MTCNN algorithm My usings:

MTCNN Class: using static Tensorflow.Binding; using static Tensorflow.KerasApi; using tfnp = Tensorflow.NumPy; using Tensorflow.Keras.Engine;

Model Class: using Tensorflow; using Tensorflow.Keras; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; using static Tensorflow.Binding; using static Tensorflow.KerasApi;

Marevv avatar Feb 21 '22 17:02 Marevv

After training, the memory will be automatically released. check your code

bigbugcc avatar Apr 25 '22 02:04 bigbugcc