TensorFlow.NET
TensorFlow.NET copied to clipboard
Issue with clearing memory from GPU
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;
After training, the memory will be automatically released. check your code