How to prevent tensorflow from allocating the totality of a GPU memory?

前端 未结 16 2615
南旧
南旧 2020-11-22 04:26

I work in an environment in which computational resources are shared, i.e., we have a few server machines equipped with a few Nvidia Titan X GPUs each.

For small to m

16条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 04:54

    this code has worked for me:

    import tensorflow as tf
    config = tf.compat.v1.ConfigProto()
    config.gpu_options.allow_growth = True
    session = tf.compat.v1.InteractiveSession(config=config)
    

提交回复
热议问题