diff --git a/fastdeploy/backends/lite/lite_backend.cc b/fastdeploy/backends/lite/lite_backend.cc index 04f139256..7e3e09f8d 100755 --- a/fastdeploy/backends/lite/lite_backend.cc +++ b/fastdeploy/backends/lite/lite_backend.cc @@ -206,24 +206,24 @@ bool LiteBackend::Infer(std::vector& inputs, // Adjust dims only, allocate lazy. tensor->Resize(inputs[i].shape); if (inputs[i].dtype == FDDataType::FP32) { - tensor->CopyFromCpu( + tensor->CopyFromCpu( reinterpret_cast(const_cast( inputs[i].CpuData()))); } else if (inputs[i].dtype == FDDataType::INT32) { - tensor->CopyFromCpu( + tensor->CopyFromCpu( reinterpret_cast(const_cast( inputs[i].CpuData()))); } else if (inputs[i].dtype == FDDataType::INT8) { - tensor->CopyFromCpu( + tensor->CopyFromCpu( reinterpret_cast(const_cast( inputs[i].CpuData()))); } else if (inputs[i].dtype == FDDataType::UINT8) { - tensor->CopyFromCpu( + tensor->CopyFromCpu( reinterpret_cast(const_cast( inputs[i].CpuData()))); } else if (inputs[i].dtype == FDDataType::INT64) { #ifdef __aarch64__ - tensor->CopyFromCpu( + tensor->CopyFromCpu( reinterpret_cast(const_cast( inputs[i].CpuData()))); #else diff --git a/fastdeploy/pybind/main.cc.in b/fastdeploy/pybind/main.cc.in index 97aafc64a..1b227edc6 100644 --- a/fastdeploy/pybind/main.cc.in +++ b/fastdeploy/pybind/main.cc.in @@ -35,6 +35,8 @@ pybind11::dtype FDDataTypeToNumpyDataType(const FDDataType& fd_dtype) { dt = pybind11::dtype::of(); } else if (fd_dtype == FDDataType::UINT8) { dt = pybind11::dtype::of(); + } else if (fd_dtype == FDDataType::INT8) { + dt = pybind11::dtype::of(); } else if (fd_dtype == FDDataType::FP16) { dt = pybind11::dtype::of(); } else { @@ -55,12 +57,14 @@ FDDataType NumpyDataTypeToFDDataType(const pybind11::dtype& np_dtype) { return FDDataType::FP64; } else if (np_dtype.is(pybind11::dtype::of())) { return FDDataType::UINT8; + } else if (np_dtype.is(pybind11::dtype::of())) { + return FDDataType::INT8; } else if (np_dtype.is(pybind11::dtype::of())) { return FDDataType::FP16; } FDASSERT(false, "NumpyDataTypeToFDDataType() only support " - "int32/int64/float32/float64/float16 now."); + "int8/int32/int64/float32/float64/float16 now."); return FDDataType::FP32; } diff --git a/fastdeploy/pybind/main.h b/fastdeploy/pybind/main.h index 471579ab1..c0ea4497a 100644 --- a/fastdeploy/pybind/main.h +++ b/fastdeploy/pybind/main.h @@ -67,9 +67,11 @@ FDDataType CTypeToFDDataType() { return FDDataType::FP32; } else if (std::is_same::value) { return FDDataType::FP64; + } else if (std::is_same::value) { + return FDDataType::INT8; } - FDASSERT(false, - "CTypeToFDDataType only support int32/int64/float32/float64 now."); + FDASSERT(false, "CTypeToFDDataType only support " + "int8/int32/int64/float32/float64 now."); return FDDataType::FP32; }