当前位置:网站首页>Tensorflow dynamically allocates video memory

Tensorflow dynamically allocates video memory

2022-06-26 09:51:00 A cloud in the sky

The first way we should all know , Mainly for Session With

config = tf.ConfigProto()  
config.gpu_options.allow_growth=True  
sess = tf.Session(config=config)

But I use Tensorflow Of Estimator, The following methods can be used

session_config = tf.ConfigProto(log_device_placement=True,allow_soft_placement=True)
session_config.gpu_options.per_process_gpu_memory_fraction = 0.8
session_config.gpu_options.allow_growth = True #  The adaptive 
run_config = tf.estimator.RunConfig(
        session_config=session_config,
        model_dir=FLAGS.output_dir,
        save_checkpoints_steps=FLAGS.save_checkpoints_steps)

If it is TPU, Is the same , does tf.estimator Change it to tf.estimator.tpu

原网站

版权声明
本文为[A cloud in the sky]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260915128979.html