在 tensorflow 中训练小型模型(< 100 mb)时 GPU 内存不足
Not enough GPU memory when training small model (< 100 mb) in tensorflow
在 tensorflow 中训练小模型(< 100 mb)总是使用过多的 GPU 内存,为什么?怎么算出来的?
默认情况下,tensorflow 可以增长到所有 GPU 内存的总量。
您可以通过为会话设置配置来限制它:
gpu_memory_fraction = 0.4 # Fraction of GPU memory to use
config = tf.ConfigProto(gpu_options=
tf.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction))
sess = tf.Session(config=config)
在 tensorflow 中训练小模型(< 100 mb)总是使用过多的 GPU 内存,为什么?怎么算出来的?
默认情况下,tensorflow 可以增长到所有 GPU 内存的总量。 您可以通过为会话设置配置来限制它:
gpu_memory_fraction = 0.4 # Fraction of GPU memory to use
config = tf.ConfigProto(gpu_options=
tf.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction))
sess = tf.Session(config=config)