tensorflow / tensorflow-gpu / tensorflow-cpu区别?

时间:2025-02-27 07:56:38

在tensorflow 中,

环境 tensorflow== tensorflow-gpu==
只有CPU cpu运行 和tensorflow一样运行
有GPU且装Cuda和Cudnn cpu运行 gpu运行
有GPU未装Cuda或Cudnn cpu运行 和tensorflow一样运行

在tensorflow 中,

环境 tensorflow-cpu== tensorflow==
只有CPU cpu运行 cpu运行
有GPU且装Cuda和Cudnn cpu运行 gpu运行
有GPU未装Cuda或Cudnn cpu运行 cpu运行

tensorflow 不再区分是否gpu,当检测到gpu并安装cuda后,自动调用gpu。

但是,有些人不需要或没有gpu,gpu适配对这部分群体是浪费的(占用不必要的资源),于是有了tensorflow-cpu,我们可以理解其为cpu only版本

(综上,也可以理解为:tensorflow==对应tensorflow-cpu==,tensorflow-gpu==对应tensorflow==)

个人理解,如有错误请指正。

参考:
/tensorflow/tensorflow/tree/v2.3.1
/tensorflow/tensorflow/tree/r1.14
Difference between installation libraries of Tensorflow GPU vs CPU