shenweichen / DeepCTR

Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
https://deepctr-doc.readthedocs.io/en/latest/index.html
Apache License 2.0
7.44k stars 2.19k forks source link

为什么GPU运行时SparseFeat中vocabulary_size的值大小不会引起错误 #535

Open T0L0ve opened 9 months ago

T0L0ve commented 9 months ago

代码就是demo中的例子,例子中SparseFeat的vocabulary_size大小设置为最大值+1

fixlen_feature_columns = [SparseFeat(feat, data[feat].max() + 1,embedding_dim=4)
                              for feat in sparse_features]

当我将其改为1时代码仍能成功运行

fixlen_feature_columns = [SparseFeat(feat, 1,embedding_dim=4)
                              for feat in sparse_features]

image 而当我禁用gpu,使用cpu训练模型时tensorflow则会提示我越界错误 image