pycharm中TensorFlow调试常见问题小结

更新时间:2023-08-03 13:04:59 阅读: 评论:0

pycharm中TensorFlow调试常见问题⼩结⽬录
1.RuntimeError:AttemptedtouaclodSession.
2.AttributeError:module‘tensorflow'hasnoattribute‘lect'
二年级上册语文古诗
3.UnicodeDecodeError:‘utf-8'codeccan'tdecodebyte0xffinposition0:invalidstartbyte
4.python中⽤plt.imshow()显⽰图像之后,程序就停⽌运⾏,必须关掉显⽰的图像才继续运⾏
5.AttributeError:module‘tensorflow.python.ops.image_ops'hasnoattribute‘per_image_whitening'
6.ValueError:Triedtoconvert‘min_object_covered'toatensorandfailed.Error:Nonevaluesnotsupported.
中山特色美食7.NameError:name‘xrange'isnotdefined
1. RuntimeError: Attempted to u a clod Session.
在pycharm下调⽤tensorflow库时,运⾏出现以下问题:
RuntimeError: Attempted to u a clod Session.
解决⽅法:将STEP=5000开始的程序整体右移,包含在“with”内
可能遇见的问题:python代码如何整体移动
选中代码,按下“Tab”键即可整体右移
选中代码,按下“Shift+Tab”键即可整体左移
打水光针的危害
2. AttributeError: module ‘tensorflow' has no attribute ‘lect'调⽤tf.lect出错
将tf.lect替换为tf.where即可
3. UnicodeDecodeError: ‘utf-8' codec can't decode byte 0xff in position 0: invalid start byte 利⽤TensorFlow的tf.gfile.FastGFile读⼊图像发⽣上述错误:
原始代码:
image_raw_data=tf.gfile.FastGFile('anglababy.jpg','r').read()将'r'修改为'rb'即可
简单手抄报模板4. python中⽤plt.imshow()显⽰图像之后,程序就停⽌运⾏,必须关掉显⽰的图像才继续运⾏
可以将show()写在进程⾥,通过调⽤进程来打开图⽚,那么进程的运⾏状态就不会影响到主程序的往下执⾏了
import threading
import Image
壮腰健肾丸class ThreadClass(threading.Thread):少习骑
def run(lf):
im=Image.open(‘z.jpg')
im.show()
孜然火腿肠
print (1)
t = ThreadClass()
t.start()
print (2)
旅行家树a=input(‘End')
运⾏结果为:先打印出‘1',然后显⽰图⽚z.jpg,接着再不关闭图⽚的情况下打印出‘2'。
具体应⽤的时候你根据需要组织代码。
5. AttributeError: module ‘tensorflow.python.ops.image_ops' has no attribute ‘per_image_whitening'

本文发布于:2023-08-03 13:04:59,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1127681.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:代码   图像   整体   问题   程序   打印
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图