What do I need K.clear_session() and del model for (Keras with Tensorflow-gpu)?

前端 未结 3 1004
情书的邮戳
情书的邮戳 2020-12-01 01:39

What I am doing
I am training and using a convolutional neuron network (CNN) for image-classification using Keras with Tensorflow-gpu as backen

3条回答
  •  無奈伤痛
    2020-12-01 02:01

    del will delete variable in python and since model is a variable, del model will delete it but the TF graph will have no changes (TF is your Keras backend). This said, K.clear_session() will destroy the current TF graph and creates a new one. Creating a new model seems to be an independent step, but don't forget the backend :)

提交回复
热议问题