调用capi时,有多个slot时,in_args怎么用
麻烦问一下,训练模型的时候,使用了不同的type,使用paddle的capi加载模型预测时,in_args怎么用, nid是[0,0,1.....]one-hot格式的,长度少于500 nid = paddle.layer.data(name='nid', type=paddle.data_type.sparse_binary_vector(500)) sub_time = paddle.layer.data(name='sub_time', type=paddle.data_type.dense_vector(1))
-
对于sparse_binary_vector请参考例子:https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/capi/examples/model_inference/sparse_binary
-
对于dense_vector请参考例子:https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/capi/examples/model_inference/dense
另外in_args没有描述清楚,不了解的同学,根本不知道在说啥~
paddle_arguments在设置时,有个Index,用来表示slot id,代码: https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/capi/arguments.h#L75
多个slot(或feature)时,使用同一个paddle_arguments,设置不同的index。
paddle_arguments_set_value(in_args, 0, sparse_mat)
paddle_arguments_set_value(in_args, 1, dense_mat)
Duplicated with #3182