美文网首页
TensorFlow vs PyTorch 1: 安装

TensorFlow vs PyTorch 1: 安装

作者: LabVIEW_Python | 来源:发表于2021-10-31 16:03 被阅读0次

之所以要对比TensorFlow vs PyTorch是因为通过比较:

  • 可以更加深刻的理解两个深度学习框架以及背后理论
  • 为未来改写相互之间的程序奠定基础
  • 最终目标:用TensorFlow 2.x / Keras 改写 YOLOv5的PyTorch实现

比较安装TensorFlow vs PyTorch。操作系统:Windows10; Python包虚拟环境管理工具:Anaconda;开发环境:Visual Studio Code
TensorFlow 2.6版本,只有纯安装TensorFlow的命令:pip install tensorflow, cuda/cudnn都需要手动安装,相见《安装TensorFlow2.6》
PyTorch,安装非常容易,一条命令完成安装,如下:

一条命令完成Pytorch以及相关依赖库的安装

在Visual Studio Code中的表现:
TensorFlow 2.6版本Visual Studio Code中,TensorFlow很多子包的自动提示是错的(自动补全功能有问题!),这对程序开发很不方便!

TensorFlow很多子包的自动提示是错的,这对程序开发很不方便
即便安装成功,在Visual Studio Code中执行TensorFlow 2.6的代码,启动不了GPU,如下:

PS C:\Users\Administrator> & C:/Users/Administrator/anaconda3/envs/tf26/python.exe d:/nn_tf/end_to_end.py
2021-10-31 15:54:23.808083: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found
2021-10-31 15:54:23.810206: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1835] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.

PyTorch 1.10版本PyTorch的自动提示是全对,非常方便开发。另外,在Visual Studio Code中运行PyTorch GPU程序也没有问题,非常方便调试!

自动提示全对,方便开发

结论 基于上述事实,从用户友好(user-friendly)的视角,即simple for people to use的角度评判:

  1. TensorFlow的安装完败给PyTorch
  2. TensorFlow在Visual Studio Code中的开发和调试,完败给PyTorch

相关文章

网友评论

      本文标题:TensorFlow vs PyTorch 1: 安装

      本文链接:https://www.haomeiwen.com/subject/bfmoaltx.html