在tensorflow 1.x中,
| 环境 | tensorflow==1.x | tensorflow-gpu==1.x |
|---|---|---|
| 只有CPU | cpu运行 | 和tensorflow一样运行 |
| 有GPU且装Cuda和Cudnn | cpu运行 | gpu运行 |
| 有GPU未装Cuda或Cudnn | cpu运行 | 和tensorflow一样运行 |
在tensorflow 2.x中,
| 环境 | tensorflow-cpu==2.x | tensorflow==2.x |
|---|---|---|
| 只有CPU | cpu运行 | cpu运行 |
| 有GPU且装Cuda和Cudnn | cpu运行 | gpu运行 |
| 有GPU未装Cuda或Cudnn | cpu运行 | cpu运行 |
tensorflow 2.x不再区分是否gpu,当检测到gpu并安装cuda后,自动调用gpu。
但是,有些人不需要或没有gpu,gpu适配对这部分群体是浪费的(占用不必要的资源),于是有了tensorflow-cpu,我们可以理解其为cpu only版本
(综上,也可以理解为:tensorflow==1.x对应tensorflow-cpu==2.x,tensorflow-gpu==1.x对应tensorflow==2.x)
个人理解,如有错误请指正。
参考:
https://github.com/tensorflow/tensorflow/tree/v2.3.1
https://github.com/tensorflow/tensorflow/tree/r1.14
Difference between installation libraries of Tensorflow GPU vs CPU
本文详细介绍了TensorFlow在1.x与2.x版本中,针对GPU与CPU的不同版本及其运行方式的区别。在2.x版本中,TensorFlow不再区分GPU版本,会自动检测并使用GPU。同时介绍了适用于仅使用CPU环境的TensorFlow-cpu版本。
2万+

被折叠的 条评论
为什么被折叠?



