Tensorflow does not release the memory after session close


Tensorflow does not release the memory after session close



I have two models.



Both model A and B works with training and test when I run them separately.
To be more efficient in training two models with same dataset,
I put their running code together.


A.training()
A.close_session() # this closes session with sess.close()
B.training()



at B.training() it occurs Resource exhausted error!



So it seems like it does not release the memory when I do the sess.close() after A.training(). This 'sess' is an attribute both A and B has separately as well. - meaning, it is being used as self.sess



Is this a bug ? Is there a solution?



.



.



I have googled and read some arguments and only closing session does not release the gpu memory though. How can I release the gpu memory so the next model can use it?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV