Fix FDASSERT in tensorrt backend

This commit is contained in:
jiangjiajun
2022-08-17 05:57:21 +00:00
parent 13a3d6f9f5
commit e623a7b6de
2 changed files with 10 additions and 21 deletions

View File

@@ -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;
}