Delete redundant code (#1222)

Update paddle_backend.cc

Delete redundant code

Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
huangjianhui
2023-02-02 15:44:52 +08:00
committed by GitHub
parent afa3b886f3
commit ba6d75f526

View File

@@ -92,23 +92,19 @@ void PaddleBackend::BuildOption(const PaddleBackendOption& option) {
bool PaddleBackend::InitFromPaddle(const std::string& model_buffer, bool PaddleBackend::InitFromPaddle(const std::string& model_buffer,
const std::string& params_buffer, const std::string& params_buffer,
const PaddleBackendOption& option) { const PaddleBackendOption& option) {
// bool PaddleBackend::InitFromPaddle(const std::string& contents) {
if (initialized_) { if (initialized_) {
FDERROR << "PaddleBackend is already initlized, cannot initialize again." FDERROR << "PaddleBackend is already initlized, cannot initialize again."
<< std::endl; << std::endl;
return false; return false;
} }
// The input/output information get from predictor is not right, use
// PaddleReader instead now
std::string contents;
config_.SetModelBuffer(model_buffer.c_str(), model_buffer.size(), config_.SetModelBuffer(model_buffer.c_str(), model_buffer.size(),
params_buffer.c_str(), params_buffer.size()); params_buffer.c_str(), params_buffer.size());
contents = model_buffer;
config_.EnableMemoryOptim(); config_.EnableMemoryOptim();
BuildOption(option); BuildOption(option);
auto reader = paddle2onnx::PaddleReader(contents.c_str(), contents.size());
// The input/output information get from predictor is not right, use
// PaddleReader instead now
auto reader = paddle2onnx::PaddleReader(model_buffer.c_str(), model_buffer.size());
// If it's a quantized model, and use cpu with mkldnn, automaticaly switch to // If it's a quantized model, and use cpu with mkldnn, automaticaly switch to
// int8 mode // int8 mode
if (reader.is_quantize_model) { if (reader.is_quantize_model) {