tensorflow怎样调用gpu_tensorflow / tensorflow-gpu / tensorflow-cpu区别?
在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.1https://github.com/tensorflow/tensorflow/tree/r1.14
Difference between installation libraries of Tensorflow GPU vs CPU
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
