word2vec 词向量

来源:互联网 发布:图片填色软件 编辑:程序博客网 时间:2024/05/29 19:38

初学TensorFlow的词向量模块,基本例程word2vec中有一句loss = tf.reduce_mean(tf.nn.nce_loss(nce_weights,nce_biases, train_labels,embed,num_sampled, voc_size)),运行之后出现以下错误:

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type int32 of argument 'x'.
应该修改成loss = tf.reduce_mean(tf.nn.nce_loss(weights=nce_weights,biases=nce_biases, labels=train_labels, inputs=embed, num_sampled=num_sampled, num_classes=voc_size))

原创粉丝点击