参考资料依旧为《人工智能原理与实践-基于python语言和tensorFlow》
使用 TensorBoard
安装方式为:在conda终端中输入:
conda install tensorboard
然后,生成图writer = tf.summary.FileWriter('.\my_graph',sess.graph)
退出后再终端输入tensorboard --logdir="my_graph"
参考资料依旧为《人工智能原理与实践-基于python语言和tensorFlow》
使用 TensorBoard
安装方式为:在conda终端中输入:
conda install tensorboard
然后,生成图writer = tf.summary.FileWriter('.\my_graph',sess.graph)
退出后再终端输入tensorboard --logdir="my_graph"
首先测试了一个书上样例:
1 | import tensorflow as tf |
报错:
1 | File "C:\Users\qinsi\tensorflow_workspace\steam_tf.py", line 8, in <module> |
这个在昨天的样例中碰到过,是v1和v2的版本区别。
修改为sess = tf.compat.v1.Session()
后可以跑起来,在run步骤报如下错误:Tensor.graph is meaningless when eager execution is enabled.
先找了一个hello跑了一下,可用:
1 | #!/usr/bin/env python |
然后查阅资料修改文件,找到一个比较通用的方法,在前面添加如下语句:
1 | import tensorflow.compat.v1 as tf |
整个程序如下:
1 | #!/usr/bin/env python |
输入结果为:
1 | (TensorFlowGPU3_9) C:\Users\qinsi\tensorflow_workspace>python steam_tf.py |
结果正确
手里的资料还是有点老,后续争取找一下tf2的相关资料进行进一步学习。
步骤:
1.下载anaconda虚拟环境,默认安装
2.下载CUDA-tools,默认安装 。测试是否成功方法,打开命令行,输入nvcc -V 看到类似如下版本号等信息就是成功
1 | (TensorFlowGPU3_9) C:\Users\qinsi>nvcc -V |
3.在anaconda中选择environments 选择中间最下面的create,创建默认环境TensorFlowGPU3_9
4.点三角号启动,选择Open Terminal
5.输入pip install tensorflow-gpu
注意:如报错,可尝试先安装pip install pip-search
6.安装完成后,python执行,然后
import tensorflow as tf
hello = tf.constant(‘hello,tf’)
sess = tf.compat.v1.Session()
输出显卡信息:
2022-02-06 02:32:19.969053: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-02-06 02:32:20.583606: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1360 MB memory: -> device: 0, name: NVIDIA GeForce GTX 750 Ti, pci bus id: 0000:01:00.0, compute capability: 5.0
表示安装成功。
使用Atlas平台进行调试
参照华为 陈老师的相关教程
陈老师的gitee地址:
https://gitee.com/shiner-chen
手头设备平台为:
DLAP221
计划为
1.按照陈老师的样子搭建vscode调试环境
2.以图片修改例子为基础,确认开发流程
在linux环境下挂载windows分区失败,dmesg提示
ntfs: (device sda9): parse_options(): Unrecognized mount option windows_names.
安装ntfs工具解决。
单位有个项目用arm9,使用一个老版本的交叉编译GCC,原有开发环境构建于32位linux。
最近该项目开始二开,领到新电脑的员工发现只能使用uefi引导,导致原指定操作系统无法使用,体现为安装后无法启动系统。
经过分析和查阅,认为是该32位系统无法支持uefi,鉴于后续64位系统将成为主流,有必要将开发环境迁移到64位系统上。初步考虑mint 19.4,安装后无法启动,提示init文件错误,查阅认为efi问题。gentoo尝试成功,但配置过程复杂且不适合作为公司开发环境。选择轻量级lubuntu,发现制作的u盘可以被正确识别和启动,但是同样存在安装到硬盘后无法启动系统的情况,于是考虑通过u盘做过渡,使用本地硬盘+u盘启动的方式,考虑u盘主要用于引导,其中内核部分放在内存,而基本工具可以使用硬盘分区,速度影响应该可接受。
首先修改u盘根目录下/boot/下grub.cfg的参数,删除quiet和splash(便于观察启动信息),删除boot=casper(该选项是通知内核使用liveCD方式启动,最后会导致系统以CDROM方式挂载。
为了能够具有一定的通用性,使用UUID指定启动盘,root=UUID=(号码),UUID通过blkid 获得 blkid /dev/sdc2
测试U盘内核似乎有一些问题,使用安装后的boot分区的内核和image替代。
启动后发现启动项,选择后,可正确引导进入linux桌面,根分区可读写。
后续花絮:
在安装环境中发现lubuntu各种缺东西,一怒之下换成了kubunut,直接安装成功(哭笑不得脸)。
在命令行输入ssh-keygen –t rsa –C “johndoe@doebrothers.com“
敲三个回车之后,在用户/用户名/.ssh目录下生成两个文件,其中.pub是公钥(上传到github)
使用KDE Plasma 5.15 ,启动器为sddm,发现在启动器界面和进入桌面过程出现闪烁。
查阅资料,有说法为intel使用开源驱动默认会导致该问题,Intel显卡的加速选项有默认方式(glamor)、加速模式(sna)和兼容模式(uxa),修改了Intel显卡的Xorg配置文件为Intel加速模式(sna),问题可解决(参照深度论坛)
在/etc/X11/xorg.conf.d/下新建20-intel.conf,内容为:
1 | Section "Device" |
打包备份后删除原有的20opengl.conf.gz
重启电脑后该问题解决
下载了一个驱动,打开看了下,是MT7601U,在内核中查找后发现内核已经自带该驱动。
mask MT7601U (drivers) to M ,
build kernel
enjoy~