diff --git a/lite/kernels/arm/calib_compute.cc b/lite/kernels/arm/calib_compute.cc index 383e868843b43f4081e1eac330b1422b79307d9c..c0b7405015916dc62fbd89cc3c95b3d14bbd2ed5 100644 --- a/lite/kernels/arm/calib_compute.cc +++ b/lite/kernels/arm/calib_compute.cc @@ -44,6 +44,17 @@ void CalibComputeInt64ToInt32::Run() { } } +template +void CalibComputeInt64ToFloat32::Run() { + auto& param = this->template Param(); + const auto* din = param.input->template data(); + std::vector scale = {param.scale}; + auto* dout = param.output->template mutable_data(); + for (auto i = 0; i < param.input->numel(); ++i) { + dout[i] = din[i]; + } +} + template void CalibComputeInt8ToFp32::Run() { auto& param = this->template Param(); @@ -133,6 +144,40 @@ REGISTER_LITE_KERNEL( DATALAYOUT(kNCHW))}) .Finalize(); +REGISTER_LITE_KERNEL( + calib, + kARM, + kFloat, + kNCHW, + paddle::lite::kernels::arm::CalibComputeInt64ToFloat32, + int64_to_float32) + .BindInput("Input", + {LiteType::GetTensorTy(TARGET(kAny), + PRECISION(kInt64), + DATALAYOUT(kNCHW))}) + .BindOutput("Out", + {LiteType::GetTensorTy(TARGET(kARM), + PRECISION(kFloat), + DATALAYOUT(kNCHW))}) + .Finalize(); + +REGISTER_LITE_KERNEL( + calib, + kARM, + kInt64, + kNCHW, + paddle::lite::kernels::arm::CalibComputeInt64ToFloat32, + int64_to_float32) + .BindInput("Input", + {LiteType::GetTensorTy(TARGET(kHost), + PRECISION(kInt64), + DATALAYOUT(kNCHW))}) + .BindOutput("Out", + {LiteType::GetTensorTy(TARGET(kARM), + PRECISION(kFloat), + DATALAYOUT(kNCHW))}) + .Finalize(); + REGISTER_LITE_KERNEL( calib_once, kARM, @@ -206,3 +251,37 @@ REGISTER_LITE_KERNEL( PRECISION(kInt32), DATALAYOUT(kNCHW))}) .Finalize(); + +REGISTER_LITE_KERNEL( + calib_once, + kARM, + kFloat, + kNCHW, + paddle::lite::kernels::arm::CalibComputeInt64ToFloat32, + int64_to_float32) + .BindInput("Input", + {LiteType::GetTensorTy(TARGET(kARM), + PRECISION(kInt64), + DATALAYOUT(kNCHW))}) + .BindOutput("Out", + {LiteType::GetTensorTy(TARGET(kARM), + PRECISION(kFloat), + DATALAYOUT(kNCHW))}) + .Finalize(); + +REGISTER_LITE_KERNEL( + calib_once, + kARM, + kInt64, + kNCHW, + paddle::lite::kernels::arm::CalibComputeInt64ToFloat32, + int64_to_float32) + .BindInput("Input", + {LiteType::GetTensorTy(TARGET(kHost), + PRECISION(kInt64), + DATALAYOUT(kNCHW))}) + .BindOutput("Out", + {LiteType::GetTensorTy(TARGET(kARM), + PRECISION(kFloat), + DATALAYOUT(kNCHW))}) + .Finalize(); diff --git a/lite/kernels/arm/calib_compute.h b/lite/kernels/arm/calib_compute.h index f10bb931df9b276bc3bb01da16906f3e5b5a7dce..365c1815bf7867131dabcfbeb251cad70153562e 100644 --- a/lite/kernels/arm/calib_compute.h +++ b/lite/kernels/arm/calib_compute.h @@ -47,6 +47,19 @@ class CalibComputeInt64ToInt32 private: }; +template +class CalibComputeInt64ToFloat32 + : public KernelLite { + public: + using param_t = operators::CalibParam; + + void Run() override; + + ~CalibComputeInt64ToFloat32() override{}; + + private: +}; + template class CalibComputeInt8ToFp32 : public KernelLite {