最近在使用tensorboardX可视化网络结构,因为tensorboardX并非pytorch原生的可视化工具,所以版本之间并不兼容

在使用的过程中会遇到,AttributeError: 'function' object has no attribute 'graph',大概是版本之间不兼容

完整错误如下

Traceback (most recent call last):
File "source_hourglassnet.py", line , in <module>
writer.add_graph(model, (input_data, ))
File "/home/yongjie/anaconda2/envs/danfeng/lib/python3.6/site-packages/tensorboardX/writer.py", line , in add_graph
self._get_file_writer().add_graph(graph(model, input_to_model, verbose, **kwargs))
File "/home/yongjie/anaconda2/envs/danfeng/lib/python3.6/site-packages/tensorboardX/pytorch_graph.py", line , in graph
graph = trace.graph
AttributeError: 'function' object has no attribute 'graph'

搜到了一个解决方案说的是tensorboardX1.8对于低版本的pytorch支持不是很好

conda list发现 tensorboardX确实是1.8版本的,pip uninstall tensorboardX之后再

重新安装pip install tensorboardX=1.4

安装完之后就可以正常使用了

没毛病

但是这里有另外一个问题就是,我用pip search tensorboardX

的时候并没有发现1.4版本的,但是我用pip install tensorboardX=1.4的时候是可以使用的,不知道为啥

tensorboardX使用中 AttributeError: 'function' object has no attribute 'graph'的更多相关文章

  1. flask_route错误:AttributeError: 'function' object has no attribute 'route'

    问题: 路由完全正确,当只有一个名为home的函数处理这个路由时候,下一个路由处理函数,总是提示没有这个rotue属性 Traceback (most recent call last): File ...

  2. python调用对象属性出错:AttributeError: 'function' object has no attribute '_name_'

    出错如下图所示: 原来是因为把__name__写成_name_, 下图为正确结果:

  3. AttributeError: 'function' object has no attribute 'as_view'

    我的描述:当我启用jwt_required来进行token验证的时候,我提示错误; 解决方案: 修改前代码: 修改后代码: 多看书.多多了解.多看看世界...

  4. Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'

    问题说明: 首先呢,报这个错误的代码是这行代码: model = Model(inputs=input, outputs=output) 报错: AttributeError 'NoneType' o ...

  5. AttributeError: 'NoneType' object has no attribute 'extend'

    Python使用中可能遇到的小问题 AttributeError: 'NoneType' object has no attribute 'extend' 或者AttributeError: 'Non ...

  6. AttributeError: 'dict' object has no attribute 'status_code'

    前端AJAX请求数据,提示错误:“AttributeError: 'dict' object has no attribute 'status_code'”. 原因:是提示返回对象dict没有“sta ...

  7. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  8. AttributeError: 'list' object has no attribute 'write_pdf'

    我在可视化决策树,运行以下代码时报错:AttributeError: 'list' object has no attribute 'write_pdf' 我使用的是python3.4 from sk ...

  9. attributeError:'module' object has no attribute ** 解决办法

    写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...

随机推荐

  1. 基于MybatisUtil工具类,完成CURD操作

    package loaderman; import java.io.IOException; import java.io.Reader; import java.sql.Connection; im ...

  2. 怎么让mysql的id从0开始

    有时候我们在测试网站的时候,删除测试数据导致id不是从0开始,那如果想id是从0开始怎么办呢?mysql默认自增ID是从1开始了,但当我们如果有插入表或使用delete删除id之后ID就会不会从1开始 ...

  3. cron表达式的用法

    cron表达式通过特定的规则指定时间,用于定时任务,本文简单记录它的部分语法和实例,并不完全,能覆盖日常大部分需求. 1. 整体结构 cron表达式是一个字符串,分为6或7个域,每两个域之间用空格分隔 ...

  4. [spring mvc][转]<mvc:default-servlet-handler/>的作用

    优雅REST风格的资源URL不希望带 .html 或 .do 等后缀.由于早期的Spring MVC不能很好地处理静态资源,所以在web.xml中配置DispatcherServlet的请求映射,往往 ...

  5. redis 超时失效key 的监听触发使用

    redis自2.8.0之后版本提供Keyspace Notifications功能,允许客户订阅Pub / Sub频道,以便以某种方式接收影响Redis数据集的事件. 可能收到的事件的例子如下: 所有 ...

  6. jekins自动部署tomcat注意事项、连接tomcat报错

    jekins自动部署tomcat注意事项 千万不要用下面插件推送,报错很多, 要用脚本,一篇博客说的:“我们都是用的脚本,插件报错太多,也不完善” Deploy to container Plugin ...

  7. Java泛型(11):潜在类型机制

    泛型的目标之一就是能够编写尽可能广泛应用的代码. 为了实现这一点,我们需要各种途径来放松对我们的代码将要作用的类型所做的限制,同时不丢失静态类型检查的好处.即写出更加泛化的代码. Java泛型看起来是 ...

  8. git合并时忽略某个文件

    因为开发现场跟部署的环境不同,有很多ip地址每次都要改来改去;于是开两个分支master(用来保存部署现场的ip)和dev(开发环境的ip),开发功能时在dev分支,然后使用master合并,每个分支 ...

  9. Spring Boot Lombok配置

    Spring Boot Lombok配置 依赖添加 dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.2' compi ...

  10. 27.IP承载网容量仿真

    接入,汇聚,核心 参考资料: 学堂在线,移动通信技术(2019秋)https://next.xuetangx.com/learn/SZIIT61031001367/SZIIT61031001367/1 ...