mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-14 04:44:00 +08:00
fix input name bug (#352)
This commit is contained in:
@@ -315,6 +315,8 @@ ModelState::ModelState(TRITONBACKEND_Model* triton_model)
|
||||
// &runtime_options_->trt_max_workspace_size));
|
||||
} else if (param_key == "cache_file") {
|
||||
runtime_options_->SetTrtCacheFile(value_string);
|
||||
} else (param_key == "use_paddle") {
|
||||
runtime_options_->EnablePaddleToTrt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1025,12 +1027,13 @@ TRITONSERVER_Error* ModelInstanceState::SetInputTensors(
|
||||
input, &input_name, &input_datatype, &input_shape, &input_dims_count,
|
||||
nullptr, nullptr));
|
||||
|
||||
if (input_tensors_[input_idx].name != std::string(input_name)) {
|
||||
int index = GetInfoIndex(std::string(input_name), input_tensor_infos_);
|
||||
if (index < 0) {
|
||||
auto err = TRITONSERVER_ErrorNew(
|
||||
TRITONSERVER_ERROR_INTERNAL,
|
||||
(std::string("Input name [") + input_name +
|
||||
std::string("] is not one of the FD predictor input: ") +
|
||||
input_tensors_[input_idx].name)
|
||||
input_tensors_[index].name)
|
||||
.c_str());
|
||||
// SendErrorForResponses(responses, request_count, err);
|
||||
return err;
|
||||
@@ -1075,12 +1078,12 @@ TRITONSERVER_Error* ModelInstanceState::SetInputTensors(
|
||||
memory_type = TRITONSERVER_MEMORY_CPU;
|
||||
device = fastdeploy::Device::CPU;
|
||||
}
|
||||
input_tensors_[input_idx].Resize(
|
||||
input_tensors_[index].Resize(
|
||||
batchn_shape, ConvertDataTypeToFD(input_datatype), input_name, device);
|
||||
collector->ProcessTensor(
|
||||
input_name,
|
||||
reinterpret_cast<char*>(input_tensors_[input_idx].MutableData()),
|
||||
input_tensors_[input_idx].Nbytes(), memory_type, device_id);
|
||||
reinterpret_cast<char*>(input_tensors_[index].MutableData()),
|
||||
input_tensors_[index].Nbytes(), memory_type, device_id);
|
||||
}
|
||||
|
||||
// Finalize...
|
||||
|
Reference in New Issue
Block a user