From 33481bb22d72f434be67bdd4e48bb702abe9db31 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Thu, 26 Dec 2019 06:55:12 +0000 Subject: [PATCH] fix bert_service_op --- demo-serving/op/bert_service_op.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo-serving/op/bert_service_op.cpp b/demo-serving/op/bert_service_op.cpp index 47828212..1261da68 100644 --- a/demo-serving/op/bert_service_op.cpp +++ b/demo-serving/op/bert_service_op.cpp @@ -172,14 +172,14 @@ int BertServiceOp::inference() { LOG(INFO) << "batch_size : " << out->at(0).shape[0] << " emb_size : " << out->at(0).shape[1]; - uint32_t emb_size = out->at(0).shape[1] float *out_data = - reinterpret_cast(out->at(0).data.data()); + uint32_t emb_size = out->at(0).shape[1]; + float *out_data = reinterpret_cast(out->at(0).data.data()); for (uint32_t bi = 0; bi < batch_size; bi++) { BertResInstance *res_instance = res->add_instances(); for (uint32_t si = 0; si < 1; si++) { EmbeddingValues *emb_instance = res_instance->add_instances(); for (uint32_t ei = 0; ei < emb_size; ei++) { - uint32_t index = bi * EMB_SIZE + ei; + uint32_t index = bi * emb_size + ei; emb_instance->add_values(out_data[index]); } } -- GitLab