目录
时间:2021/7/15
编辑器:使用富文本
- 1
- 2
- 3
- 1
- 2
import tensorflow as tf gpus = tf.config.experimental.list_physical_devices('GPU') if gpus: try: # Restrict TensorFlow to only use the fourth GPU tf.config.experimental.set_visible_devices(gpus[0], 'GPU') # Currently, memory growth needs to be the same across GPUs for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) logical_gpus = tf.config.experimental.list_logical_devices('GPU') print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs") except RuntimeError as e: # Memory growth must be set before GPUs have been initialized print(e)
- 3
import os
import sys
test1 | test2 |
1 | 2 |
引流:xd友链
over