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. html表格导出Excel的实例

    1. 拼成出完整的HMTL的Table代码片段后,转成二进制byte[]类型并存入数据库中,供下载时调出来使用. System.Text.StringBuilder sb = new StringBu ...

  2. Mapbox显示地图案例

    mapbox地图入门案例 <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <titl ...

  3. 【Dart学习】--Dart之数组(List)的相关方法总结

    一,初始化List 非固定长度list var testList = List(); print(testList.length);//输出0 固定长度List var testList2 = Lis ...

  4. Spring cloud微服务安全实战-6-8sentinel限流实战

    阿里2018年开源的. 简单来说就是干三件事,最终的结果就是保证你的服务可用,不会崩掉.保证服务高可用. 流控 先从最简单的场景来入手. 1.引用一个依赖, 2,声明一个资源. 3.声明一个规则 注意 ...

  5. 123457123456#0#----com.ppGame.ChengYu43--前拼后广--成语caicaicai_pp

    com.ppGame.ChengYu43--前拼后广--成语caicaicai_pp

  6. 使用Spring Boot接受HTTP GET/POST请求的一个SQL并返回结果

    这里说的意思是:我向我的Web服务器发送一个请求(因为GET请求的一些限制,所以最好使用POST请求,不过这里作为测试还是使用GET请求),请求中带一个sql参数,它对应查询的数据.然后我的Sprin ...

  7. 测试框架nunit之assertion断言使用详解

    任何xUnit工具都使用断言进行条件的判断,NUnit自然也不例外,与其它的xUnit(如Junit.phpUnit.pythonUnit)相比,由于大量使用了Generic.Attribute等语言 ...

  8. MySQL报错argument out of range 1055解决办法

    参考:https://www.cnblogs.com/liangbenstudy/p/10246895.html MySQL 5.7.22查询时候报错 argument out of range 报错 ...

  9. docker里安装kali linux

    docker里安装kali linux 官网镜像 docker search kali docker pull kalilinux/kali-linux-docker vi /etc/apt/sour ...

  10. 你应该知道的4个DSP开发支持库

    引言 在dsp开发中,为了节省开发时间和难度,TI将一些成熟的算法封装为模块,供开发者使用.如果能充分利用这些算法支持库,对于加快dsp开发进程与提高代码质量.稳定性有非常大的帮助. Digital ...