tensorflow2.1GPU显存限制
tensorflow2.1显存限制 查了一下午,查到的方法全都无法解决,在绝望的时候从 API 中找到了正解 1.tensorflow v1使用如下用法 opts = tf . GPUOptions ( per_process_gpu_memory_fraction = 0.5 ) sess = tf . Session ( config = tf . ConfigProto ( gpu_options = opts ) ) 2.tensorflow v2.0α版本使用如下用法 tensorflow . config . gpu . set_per_process_memory_fraction ( 0.75 ) tensorflow . config . gpu . set_per_process_memory_growth ( True ) 但是该用法很快被替换掉,解决方法向下看 3.tensorflow v2.1版本使用如下用法 gpus = tf . config . experimental . list_physical_devices ( 'GPU' ) #获取GPU列表 tf . config . experimental . set_virtual_device_configuration ( gpus [ 0 ] , [ tf . config .