AttributeError: ‘numpy.ndarray‘ object has no attribute ‘cuda‘
2020-07-23 16:40
260 查看
这种类型的错误都是由于没有转换为tensor张量导致的,只需要注意使用cuda()前通过torch.tensor()转为tensor就可以了,例如这样:resnet(Variable(torch.tensor(img).cuda()))
相关文章推荐
- ubuntu18.04+anaconda安装opencv出现AttributeError: type object 'numpy.ndarray' has no attribute '__array_
- 关于AttributeError:'numpy.ndarray' object has no attribute 'index'
- AttributeError: 'numpy.ndarray' object has no attribute 'append'
- AttributeError: 'numpy.ndarray' object has no attribute 'index'
- 'numpy.ndarray' object has no attribute 'values'
- Python 保存数组至.mat文件,报错:AttributeError: 'numpy.ndarray' object has no attribute 'items'
- Tensorflow 解决AttributeError: 'RefVariable' object has no attribute 'numpy'报错信息
- python数据分析与挖掘实战之决策树(提示numpy.ndarray' object has no attribute 'columns)
- AttributeError: 'numpy.ndarray' object has no attribute 'value_counts'
- AttributeError: 'module' object has no attribute 'SummaryWriter'解决方法
- AttributeError: ‘NoneType’ object has no attribute ‘clone’
- AttributeError: '_Screen' object has no attribute 'onkeypress' python 的例子
- web.py 启动时候出现AttributeError: 'module' object has no attribute 'inet_pton'错误
- Flask 上的 AttributeError: 'bool' object has no attribute '__call__'问题
- web.py 启动时候出现AttributeError: 'module' object has no attribute 'inet_pton'错误
- AttributeError: 'str' object has no attribute 'decode'
- AttributeError: 'list' object has no attribute 'write_pdf'
- AttributeError: 'module' object has no attribute 'LabelMap'
- AttributeError: 'module' object has no attribute 'Serial'
- AttributeError: 'module' object has no attribute '_handlerList' 错误解决方法