最近在使用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. rsync+inotify实时数据同步

    没有实际的用过,先mark一下,后面实践. https://www.osyunwei.com/archives/7447.html 一.为什么要用Rsync+sersync架构? 1.sersync是 ...

  2. CentOS8 缺少 libglade2 安装包的回避方法

    某些gtk2应用程序需要libglade2安装包,但不知为何CentOS的yum仓库里没有此包, 经测试,可手动安装CentOS7的rpm包安装解决. 更新:使用下面一行即可.sudo yum ins ...

  3. Java集合(6):理解Map

    映射表的基本思想是维护键-值对的关联,通过键来寻找值.下面是标准Java类库中几种Map的实现: (1) HashMap:Map基于散列表的实现,插入和查询键值对的开销是固定的.可以通过构造器设置容量 ...

  4. Google 搜索语法

    1. 逻辑与/或:AND/OR注意 AND.OR 必须大写OR 指令优先于 AND 指令AND 指令一般以space或+代替OR 指令可用 | 代替2. 逻辑非:-3. 完整匹配:" &qu ...

  5. Windows Server 2019 SSH Server

    Windows Server 2019 SSH Server   在需要安裝的ws2019开启powershell,执行安装 openssh server 指令 Add-WindowsCapabili ...

  6. 部署kubernetes-prometheus和用kubespray部署kubernetes后修改kubelet的

    1.kubespray的配置文件 /opt/kubespray/inventory/mycluster/group_vars/all/all.yml# kube_read_only_port: 102 ...

  7. Springboot Actuator之一:执行器Actuator入门介绍

    介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...

  8. python列表与字符串、元组的区别以及列表引用的方式

    一.字符串 字符串也可以用下标取值.切片.for循环.len()取长度以及 in 和 not in 来进行操作. 但字符串是不可变的,不能被更改.只能构造一个“新的”字符串来存取你想要修改后的数据. ...

  9. 安装oracle数据库11g及问题解决

    安装步骤可借鉴https://www.cnblogs.com/qfb620/p/4577255.html 1.安装后发现用Navicat无法连接数据库显示报错ORA-28547:connection ...

  10. Hadoop部署(伪分布式系统)

    hadoop安装 #修改主机名 hostnamectl set-hostname hadoop #修改hosts vim /etc/hosts #追加到末尾 10.0.0.11 hadoop 安装必备 ...