mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00
Fix directly visit member of FDTensor (#193)
* optimize tensorrt usage * format code * fix input shape error for onnx model * Remove some code directly visit FDTensor member (#192) remove some code directly visit FDTensor member * fix directly visit member of FDTensor Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com>
This commit is contained in:
@@ -79,7 +79,7 @@ void BindRuntime(pybind11::module& m) {
|
||||
// TODO(jiangjiajun) Maybe skip memory copy is a better choice
|
||||
// use SetExternalData
|
||||
inputs[index].data.resize(iter->second.nbytes());
|
||||
memcpy(inputs[index].data.data(), iter->second.mutable_data(),
|
||||
memcpy(inputs[index].MutableData(), iter->second.mutable_data(),
|
||||
iter->second.nbytes());
|
||||
inputs[index].name = iter->first;
|
||||
index += 1;
|
||||
@@ -94,7 +94,7 @@ void BindRuntime(pybind11::module& m) {
|
||||
auto numpy_dtype = FDDataTypeToNumpyDataType(outputs[i].dtype);
|
||||
results.emplace_back(
|
||||
pybind11::array(numpy_dtype, outputs[i].shape));
|
||||
memcpy(results[i].mutable_data(), outputs[i].data.data(),
|
||||
memcpy(results[i].mutable_data(), outputs[i].Data(),
|
||||
outputs[i].Numel() * FDDataTypeSize(outputs[i].dtype));
|
||||
}
|
||||
return results;
|
||||
@@ -134,4 +134,4 @@ void BindRuntime(pybind11::module& m) {
|
||||
m.def("get_available_backends", []() { return GetAvailableBackends(); });
|
||||
}
|
||||
|
||||
} // namespace fastdeploy
|
||||
} // namespace fastdeploy
|
||||
|
Reference in New Issue
Block a user