fluid版本nce使用的疑惑
Created by: 333caowei
参考了v2的nce用法,https://github.com/PaddlePaddle/models/blob/develop/legacy/youtube_recall/network_conf.py
使用fluid训练nce:
cost = fluid.layers.nce(
input=source_semantic_vec,
label=self.label,
num_total_classes=self.feature_size_dict['LABEL_DICT_SIZE'] + 1,
param_attr=fluid.ParamAttr(name="nce_w"),
bias_attr=fluid.ParamAttr(name="nce_b"),
num_neg_samples=70)
avg_cost = fluid.layers.mean(cost)
return [avg_cost, source_semantic_vec, self.source_data, self.label]
使用fluid.io.save_inference_model保存模型,但是nce的返回值只是个cost,在save_inference_model时候如何保存softmax预测值呢,另外fluid也没有v2中的paddle.layer.trans_full_matrix_projection,请问如何处理source_semantic_vec向量