10 lines
242 B
Python
10 lines
242 B
Python
|
|
import tensorflow as tf
|
||
|
|
|
||
|
|
def print_gpu_availability():
|
||
|
|
"""打印Tensorflow的GPU可用性"""
|
||
|
|
gpus = tf.config.list_physical_devices('GPU')
|
||
|
|
if gpus:
|
||
|
|
print("GPU is available")
|
||
|
|
else:
|
||
|
|
print("GPU is not available")
|