# Tensorflow setup ###### tags: `機器學習` `Machine Learning` ## GPU configurations table https://www.tensorflow.org/install/source#gpu ## Limiting gpu memory groth ```(python) # TL;DR gpus = tf.config.list_physical_devices('GPU') if gpus: # Restrict TensorFlow to only use the first GPU try: tf.config.set_visible_devices(gpus[0], 'GPU') logical_gpus = tf.config.list_logical_devices('GPU') print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPU") except RuntimeError as e: # Visible devices must be set before GPUs have been initialized print(e) ``` Read more: https://www.tensorflow.org/guide/gpu#limiting_gpu_memory_growth