Browse Source

delete useless code

tags/v1.1.0
gukecai 5 years ago
parent
commit
7ceeb5a519
2 changed files with 0 additions and 109 deletions
  1. +0
    -105
      mindspore_serving/ccsrc/master/restful/http_process.cc
  2. +0
    -4
      mindspore_serving/ccsrc/master/restful/http_process.h

+ 0
- 105
mindspore_serving/ccsrc/master/restful/http_process.cc View File

@@ -1098,110 +1098,5 @@ Status RestfulService::ParseInstancesReply(const PredictReply &reply, json *cons
return status;
}

// For test, to be deleted
void RestfulService::FadeReply(const proto::PredictRequest &request, proto::PredictReply *reply) {
MSI_EXCEPTION_IF_NULL(reply);
MSI_LOG_INFO << "Start";
if (request_type_ == kInstanceType) {
size_t instances_size = request.instances_size();
for (size_t i = 0; i < instances_size; i++) {
auto cur_instance = request.instances(i);
auto target_ptr = reply->add_instances();
for (const auto &item : cur_instance.items()) {
auto key = item.first;
auto tensor = item.second;
auto &map_item = *(target_ptr->mutable_items());
map_item[key] = tensor;
}
}
} else {
MSI_LOG_ERROR << "only support two kind type";
}
MSI_LOG_INFO << "End";
}

void RestfulService::PrintRequest(const proto::PredictRequest *const request) {
MSI_LOG_INFO << "=============start print quest==================";
if (request_type_ == kInstanceType) {
size_t size = request->instances_size();
MSI_LOG_INFO << "instance size:" << request->instances_size();
for (size_t i = 0; i < size; i++) {
auto instance = request->instances(i);
auto &cur_map = instance.items();
MSI_LOG_INFO << "map size:" << cur_map.size();
for (const auto &item : cur_map) {
MSI_LOG_INFO << "======deail instance=======";
auto key = item.first;
auto &tensor = item.second;
const ProtoTensor pb_tensor(const_cast<proto::Tensor *>(&tensor));
MSI_LOG_INFO << "key:" << key;
DataType type = pb_tensor.data_type();
MSI_LOG_INFO << "data type:" << type;
auto shape = pb_tensor.shape();
for (const auto &item1 : shape) {
MSI_LOG_INFO << "shape:" << item1;
}

size_t data_size = pb_tensor.data_size();
MSI_LOG_INFO << "data size:" << data_size;

auto data = reinterpret_cast<const int32_t *>(pb_tensor.data());
MSI_LOG_INFO << "data value:" << data;

size_t bytes_data_size = pb_tensor.bytes_data_size();
MSI_LOG_INFO << "bytest data size:" << bytes_data_size;
for (size_t k = 0; k < bytes_data_size; k++) {
const uint8_t *data1;
size_t bytes_len;
pb_tensor.get_bytes_data(k, &data1, &bytes_len);
MSI_LOG_INFO << "start ptr:" << data1 << "; bytes length:" << bytes_len;
}
}
}
} else {
MSI_LOG_ERROR << "=========Print Failed";
}
MSI_LOG_INFO << "=============End print request==================";
}

void RestfulService::PrintReply(const proto::PredictReply &reply) {
MSI_LOG_INFO << "=============start print reply==================";
if (request_type_ == kInstanceType) {
size_t size = reply.instances_size();
MSI_LOG_INFO << "instance size:" << reply.instances_size();
for (size_t i = 0; i < size; i++) {
auto instance = reply.instances(i);
auto &cur_map = instance.items();
MSI_LOG_INFO << "map size:" << cur_map.size();
for (const auto &item : cur_map) {
MSI_LOG_INFO << "======deail instance=======";
auto key = item.first;
auto &tensor = item.second;
const ProtoTensor pb_tensor(const_cast<proto::Tensor *>(&tensor));
MSI_LOG_INFO << "key:" << key;
DataType type = pb_tensor.data_type();
MSI_LOG_INFO << "data type:" << type;
auto shape = pb_tensor.shape();
for (const auto &item1 : shape) {
MSI_LOG_INFO << "shape:" << item1;
}

size_t data_size = pb_tensor.data_size();
MSI_LOG_INFO << "data size:" << data_size;
size_t bytes_data_size = pb_tensor.bytes_data_size();
MSI_LOG_INFO << "bytest data size:" << bytes_data_size;
for (size_t k = 0; k < bytes_data_size; k++) {
const uint8_t *data;
size_t bytes_len;
pb_tensor.get_bytes_data(k, &data, &bytes_len);
MSI_LOG_INFO << "start ptr:" << data << "; bytes length:" << bytes_len;
}
}
}
} else {
MSI_LOG_ERROR << "=========Print Failed";
}
}

} // namespace serving
} // namespace mindspore

+ 0
- 4
mindspore_serving/ccsrc/master/restful/http_process.h View File

@@ -94,10 +94,6 @@ class RestfulService {
bool IsString();
void ParseErrorMsg(const proto::ErrorMsg &error_msg, json *const js);

void PrintRequest(const proto::PredictRequest *const request);
void PrintReply(const proto::PredictReply &reply);
void FadeReply(const proto::PredictRequest &request, proto::PredictReply *reply);

RequestType request_type_{kInvalidType};
InstancesType instances_type_{kInvalidWay};
int64_t instances_nums_{0};


Loading…
Cancel
Save