From fc94f765d54c5195b96bf81d403eb5a6bd0539b6 Mon Sep 17 00:00:00 2001 From: wangjiawei04 Date: Thu, 19 Mar 2020 20:12:26 +0800 Subject: [PATCH] replace feed_alias_name with feed_name --- .../op/general_dist_kv_infer_op.cpp | 16 +++++++++------- core/predictor/proto/framework.proto | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) mode change 100644 => 100755 core/general-server/op/general_dist_kv_infer_op.cpp mode change 100644 => 100755 core/predictor/proto/framework.proto diff --git a/core/general-server/op/general_dist_kv_infer_op.cpp b/core/general-server/op/general_dist_kv_infer_op.cpp old mode 100644 new mode 100755 index 90b7b9fb..ac4e7bb2 --- a/core/general-server/op/general_dist_kv_infer_op.cpp +++ b/core/general-server/op/general_dist_kv_infer_op.cpp @@ -17,12 +17,13 @@ #include #include #include +#include +#include #include "core/cube/cube-api/include/cube_api.h" #include "core/predictor/framework/infer.h" #include "core/predictor/framework/memory.h" #include "core/predictor/framework/resource.h" #include "core/util/include/timer.h" -#include namespace baidu { namespace paddle_serving { @@ -56,7 +57,7 @@ int GeneralDistKVInferOp::inference() { std::vector values; int sparse_count = 0; int dense_count = 0; - std::vector> dataptr_size_pairs; + std::vector> dataptr_size_pairs; size_t key_len = 0; for (size_t i = 0; i < in->size(); ++i) { if (in->at(i).dtype != paddle::PaddleDType::INT64) { @@ -75,15 +76,16 @@ int GeneralDistKVInferOp::inference() { keys.resize(key_len); int key_idx = 0; for (size_t i = 0; i < dataptr_size_pairs.size(); ++i) { - std::copy(dataptr_size_pairs[i].first, dataptr_size_pairs[i].first + dataptr_size_pairs[i].second, keys.begin() + key_idx); - key_idx += dataptr_size_pairs[i].second; + std::copy(dataptr_size_pairs[i].first, + dataptr_size_pairs[i].first + dataptr_size_pairs[i].second, + keys.begin() + key_idx); + key_idx += dataptr_size_pairs[i].second; } rec::mcube::CubeAPI *cube = rec::mcube::CubeAPI::instance(); - // TODO: temp hard code "test_dict" here, fix this with next commit - // related to cube conf std::vector table_names = cube->get_table_names(); if (table_names.size() == 0) { LOG(ERROR) << "cube init error or cube config not given."; + return -1; } int ret = cube->seek(table_names[0], keys, &values); @@ -121,7 +123,7 @@ int GeneralDistKVInferOp::inference() { sparse_out[sparse_idx].shape.push_back( sparse_out[sparse_idx].lod[0].back()); sparse_out[sparse_idx].shape.push_back(EMBEDDING_SIZE); - sparse_out[sparse_idx].name = model_config->_feed_alias_name[i]; + sparse_out[sparse_idx].name = model_config->_feed_name[i]; sparse_out[sparse_idx].data.Resize(sparse_out[sparse_idx].lod[0].back() * EMBEDDING_SIZE * sizeof(float)); float *dst_ptr = static_cast(sparse_out[sparse_idx].data.data()); diff --git a/core/predictor/proto/framework.proto b/core/predictor/proto/framework.proto old mode 100644 new mode 100755 index 5adf2a18..c0fb3ada --- a/core/predictor/proto/framework.proto +++ b/core/predictor/proto/framework.proto @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. +/* Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -- GitLab