mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +08:00
Fix FDASSERT in tensorrt backend
This commit is contained in:
@@ -34,7 +34,7 @@ pybind11::dtype FDDataTypeToNumpyDataType(const FDDataType& fd_dtype) {
|
||||
dt = pybind11::dtype::of<uint8_t>();
|
||||
} else {
|
||||
FDASSERT(false, "The function doesn't support data type of %s.",
|
||||
Str(fd_dtype).c_str());
|
||||
Str(fd_dtype).c_str());
|
||||
}
|
||||
return dt;
|
||||
}
|
||||
@@ -73,8 +73,7 @@ void PyArrayToTensor(pybind11::array& pyarray, FDTensor* tensor,
|
||||
pybind11::array TensorToPyArray(const FDTensor& tensor) {
|
||||
auto numpy_dtype = FDDataTypeToNumpyDataType(tensor.dtype);
|
||||
auto out = pybind11::array(numpy_dtype, tensor.shape);
|
||||
memcpy(out.mutable_data(), tensor.Data(),
|
||||
tensor.Numel() * FDDataTypeSize(tensor.dtype));
|
||||
memcpy(out.mutable_data(), tensor.Data(), tensor.Numel() * FDDataTypeSize(tensor.dtype));
|
||||
return out;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user