tensorflow学习

tensorflow分为CPU和GPU两个版本。
tensorflow支持python和C

文章目录

  • TensorBoard
  • 安装tensorflow
  • 更新tensorflow
  • 离线安装方式
    • tensorflow与pyhon版本以及操作系统有兼容性
    • tensorflow镜像文件安装安装
  • TensorFlow2.0
  • 参考来源链接


TensorBoard

运行在浏览器上,是神经网络调试的工具。可以看到accuracy、layer、loss等的变化曲线。网络框架、训练变化过程等。可视化程度很高。值得学习。


安装tensorflow

以管理员方式运行命令提示符:
CPU版本

pip install tensorflow

GPU版本,需要提前预装CUDA和cuDNN。
1.命令行输入 nvidia-smi
检查是否安装了驱动。
2.安装CUDA。(千万不要下载CUDA10.2,最新版本的tensorflow全都不支持,最新版本的tensorflow2.2最高只支持10.1)下载地址:
https://developer.nvidia.com/cuda-toolkit-archive
3.安装cuDNN。下载地址:
https://developer.nvidia.com/rdp/cudnn-archive

pip install tensorflow-gpu

安装tensorflow的时候各种报错,后来按照下面的博文,直接在Anaconda Prompt的命令行中用指令:“conda install tensorflow-gpu”直接安装,并且该指令在安装TensorFlow时还会顺带把Cuda和CuDNN也给装了。
也就是用:

conda install tensorflow-gpu

博文链接为:感谢博文作者。
https://blog.csdn.net/weixin_39290638/article/details/80045236


更新tensorflow

更新需要先卸载就版本的。

pip uninstall tensorflow
pip install tensorflow

离线安装方式

用cmd直接下载安装太慢了,我这里网速差。可以单独下载tensorflow安装包,然后直接离线安装。
tensorflow-gpu安装包下载地址:
http://mirrors.aliyun.com/pypi/simple/tensorflow-gpu/
tensorflow-cpu安装包下载地址:
https://pypi.org/project/tensorflow/#files

tensorflow与pyhon版本以及操作系统有兼容性

例:tensorflow_gpu-2.0.0a0-cp37-cp37m-win_amd64.whl
gpu-2.0版本,cp37代表python3.7版本,win_代表适用于windows系统
选择与本地环境相适应的版本下载。

tensorflow镜像文件安装安装

cmd打开命令提示窗口,这里默认本地已经安装python的情况下进行pip install (tensorflow镜像文件本地绝对路径)
例:pip install C:\Users\yulai88\tensorflow_gpu-2.0.0a0-cp37-cp37m-win_amd64.whl(此处是我的本地路径)

安装完后运行,发现报错:
The HDF5 header files used to compile this application do not match…
tensorflow学习_第1张图片
提示库函数版本不匹配。
简单粗暴的方法为:卸载,重载

pip uninstall h5py 
pip install h5py

TensorFlow2.0

tensorflow学习_第2张图片
tensorflow学习_第3张图片
tensorflow学习_第4张图片

参考来源链接

https://blog.csdn.net/AAlonso/article/details/81504036
https://blog.csdn.net/xisan505/article/details/90438484
https://blog.csdn.net/weixin_39290638/article/details/80045236
https://blog.csdn.net/weixin_40546602/article/details/81393681

你可能感兴趣的:(tensorflow学习)