机器学习/tensorflow:修订间差异
来自康健生活
< 机器学习
| 第15行: | 第15行: | ||
2.7.0 | 2.7.0 | ||
</syntaxhighlight>|$|/home/kangkk}} | </syntaxhighlight>|$|/home/kangkk}} | ||
记录设备指派,查看安装的是 CPU 版本还是 GPU 版本。 | |||
{{Hc|checkCPUorGPU.py|<syntaxhighlight lang="python"> | |||
from tensorflow.python.client import device_lib | |||
print(device_lib.list_local_devices())</syntaxhighlight>}} | |||
2022年1月11日 (二) 03:23的版本
引言
tensorflow 分为 CPU 版本和 GPU 版本。
卸载
安装
/home/kangkk
# cpu
pip3 install --user --upgrade tensorflow
# gpu
pip3 install --user --upgrade tensorflow-gpu
验证
[jian@kang /home/kangkk]$
python3 -c "import tensorflow as tf; print(tf.__version__)"
2.7.0
记录设备指派,查看安装的是 CPU 版本还是 GPU 版本。
checkCPUorGPU.py
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
No categories