在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

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐