Pytorch:module 'torch' has no attribute 'bool'

这个应该是有些版本的Pytorch会遇到这个问题,我用0.4.0版本测试发现torch.bool是有的,但是1.0.0确实没有了,我看了一篇文章:

来源:http://www.sohu.com/a/332756215_473283

Pytorch 1.2.0 来了!

比较操作返回的数据类型由 torch.uint8 变为 torch.bool

1>>> torch.tensor([1, 2, 3]) < torch.tensor([3, 1, 2])

2tensor([1, 0, 0], dtype=torch.uint8)

所以应该猜测是1.2.0之前的版本会有这个问题。

解决办法就是把torch.bool换成torch.uint8

Pytorch:module 'torch' has no attribute 'bool'的更多相关文章

  1. module 'torch' has no attribute 'gesv'

    新版torch不支持gesv,使用solve函数. Kt, _ = torch.gesv(P.mm(H.t()).t(), S) 改成 Kt, _ = torch.solve(P.mm(H.t()). ...

  2. pytorch版本问题:AttributeError: 'module' object has no attribute '_rebuild_tensor_v2'

    用pytorch加载训练好的模型的时候遇到了如下的问题: AttributeError: 'module' object has no attribute '_rebuild_tensor_v2' 到 ...

  3. Intel发布神经网络压缩库Distiller:快速利用前沿算法压缩PyTorch模型——AttributeError: module ‘tensorboard' has no attribute 'lazy'

    转载自:CSDN Nine-days   近日,Intel 开源了一个用于神经网络压缩的开源 Python 软件包 Distiller,它可以减少深度神经网络的内存占用.加快推断速度及节省能耗.Dis ...

  4. 解决:pipenv shell报错:AttributeError: 'module' object has no attribute 'run'

    利用pipenv shell切换到虚拟环境时,显示报错:AttributeError: 'module' object has no attribute 'run' 可以看到是d:\program\p ...

  5. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

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

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

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

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

  8. AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'

    /*************************************************************************** * AttributeError: 'modu ...

  9. 【.NET调用Python脚本】C#调用python requests类库报错 'module' object has no attribute '_getframe' - IronPython 2.7

    最近在开发微信公众号,有一个自定义消息回复的需求 比如用户:麻烦帮我查询一下北京的天气? 系统回复:北京天气,晴,-℃... 这时候需要根据关键字[北京][天气],分词匹配需要执行的操作,然后去调用天 ...

随机推荐

  1. 干货满满!10分钟看懂Docker和K8S(转)

    2010年,几个搞IT的年轻人,在美国旧金山成立了一家名叫“dotCloud”的公司. 这家公司主要提供基于PaaS的云计算技术服务.具体来说,是和LXC有关的容器技术. LXC,就是Linux容器虚 ...

  2. window TOMCAT 端口被占用了怎么办?

    查看80端口被哪些程序占用了 netstat -ano|findstr "80" 根据pid(进程id) 查询对应的应用程序 tasklist|findstr "1828 ...

  3. 转 Zabbix 3.2.6通过SNMP和iDRAC监控DELL服务器

    https://www.cnblogs.com/saneri/p/7772641.html

  4. Debugging Kafka connect

    1. setup debug configuration mainClass: org.apache.kafka.connect.cli.ConnectDistributed VMOption: -D ...

  5. PP篇9 更改计划订单

    首先看了下这个函数的版本  还挺新的 S4版本应该是有更新过,里面用了新语法 导入: PLANNEDORDER    计划订单号HEADERDATA          表头数据(来自外部系统) HEA ...

  6. Shell中 2>/dev/null

    1.文件描述符 Linux系统预留可三个文件描述符:0.1和2,他们的意义如下所示: 0——标准输入(stdin) 1——标准输出(stdout) 2——标准错误(stderr) 标准输出——stdo ...

  7. Linux 指令表

    Linux简介(了解) Linux介绍 Linux是类UNIX计算机的统称 Linux操作系统的内核也是Linux Linux是由芬兰大学生Linux Torvalds于1991年编写的 Linux这 ...

  8. 通过git命令“六步”提交新项目到码云

    通过git命令“六步”提交新项目到码云 一.初始化本地仓库 git init 二.添加文件 git add . 三.添加远程数据仓库链接 git remote add origin https://g ...

  9. PDO 查询mysql返回字段int变为String型解决方法

    PDO 查询mysql返回字段int变为String型解决方法使用PDO查询mysql数据库时,执行prepare,execute后,返回的字段数据全都变为字符型. 例如id在数据库中是Int的,查询 ...

  10. 在eNSP上简单的模拟企业网络场景(不同网段互连)

    额..首先你要有eNSP工具和Wireshark抓包工具,没有的话可以上网搜索一下,最好下载最新版本的,新版本中拥有更多型号的机器 这个实验我们主要模拟某公司购买了新的路由器和交换机.交换机S1连接客 ...