栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType),

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType),

完整报错如下:

TypeError: empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType), but expected one of:
 * (tuple of ints size, *, tuple of names names, torch.memory_format memory_format, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
 * (tuple of ints size, *, torch.memory_format memory_format, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)

参考自:https://blog.csdn.net/qq_25105061/article/details/123705011

说是不能是浮点型,所以这里定位到nn.Embedding的位置,feature_fields这个列表确实都是浮点型的,改成int类型即可

feature_fields = data_X.max().values + 1
feature_fields = feature_fields.astype(np.int)
print(feature_fields)
print(sum(feature_fields))
[     2      2      2      2      2      2      2      2      2      2
      2      2      2    869    525 117271  53414    210     13   9476
    407      3  18942   4274 102028   2989     26   6932  82353     10
   3192   1593      4  93248     15     14  21964     60  17029]
536887
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1021780.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号