From 306d09d1a519c79457cca698d2100286b10724c4 Mon Sep 17 00:00:00 2001 From: huzhiqiang <912790387@qq.com> Date: Sat, 15 May 2021 19:51:33 +0800 Subject: [PATCH] [Windows] Fix windows compiling error (#6092) --- lite/backends/x86/math/sequence_pooling.cc | 7 ++++--- lite/backends/x86/math/softmax.cc | 11 ++++++----- lite/kernels/x86/grid_sampler_compute.cc | 6 ++++++ lite/kernels/x86/gru_unit_compute.cc | 6 ++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lite/backends/x86/math/sequence_pooling.cc b/lite/backends/x86/math/sequence_pooling.cc index c1ddb030349..42ebd2bc8c3 100644 --- a/lite/backends/x86/math/sequence_pooling.cc +++ b/lite/backends/x86/math/sequence_pooling.cc @@ -396,9 +396,10 @@ class SequencePoolGradFunctor { }; template class SequencePoolFunctor; -template class SequencePoolFunctor; -template class SequencePoolGradFunctor; -template class SequencePoolGradFunctor; +// Note: these implementations have not been called yet +// Template class SequencePoolFunctor; +// Template class SequencePoolGradFunctor; +// Template class SequencePoolGradFunctor; } // namespace math } // namespace x86 diff --git a/lite/backends/x86/math/softmax.cc b/lite/backends/x86/math/softmax.cc index 1f7144dd8ba..a0591a33914 100644 --- a/lite/backends/x86/math/softmax.cc +++ b/lite/backends/x86/math/softmax.cc @@ -21,11 +21,12 @@ namespace x86 { namespace math { template class SoftmaxFunctor; -template class SoftmaxFunctor; -template class SoftmaxFunctor; -template class SoftmaxFunctor; -template class SoftmaxGradFunctor; -template class SoftmaxGradFunctor; +// note: these implemetaions have not been called yet +// template class SoftmaxFunctor; +// template class SoftmaxFunctor; +// template class SoftmaxFunctor; +// template class SoftmaxGradFunctor; +// template class SoftmaxGradFunctor; } // namespace math } // namespace x86 diff --git a/lite/kernels/x86/grid_sampler_compute.cc b/lite/kernels/x86/grid_sampler_compute.cc index 90dce46e4ba..5a5a1e0f886 100644 --- a/lite/kernels/x86/grid_sampler_compute.cc +++ b/lite/kernels/x86/grid_sampler_compute.cc @@ -293,6 +293,7 @@ void BilinearInter(const X86Context& ctx, template void GridSamplerCompute::Run() { +#ifndef WIN32 auto& param = this->Param(); auto& context = ctx_->As(); auto* input = param.x; @@ -328,6 +329,11 @@ void GridSamplerCompute::Run() { grid_y_t = grid_y_t.round(); GetGridPointValue(*input, output, grid_x, grid_y); } +#else + LOG(FATAL) << "Error: This model is not supported on Windows Os yet, because " + "grid_sample op is not supported on windows Paddle-Lite, " + "please update your Paddle-Lite version."; +#endif } } // namespace x86 diff --git a/lite/kernels/x86/gru_unit_compute.cc b/lite/kernels/x86/gru_unit_compute.cc index e99eb6d7fff..bcbdd641881 100644 --- a/lite/kernels/x86/gru_unit_compute.cc +++ b/lite/kernels/x86/gru_unit_compute.cc @@ -27,6 +27,7 @@ using EigenMatrix = lite::fluid::EigenMatrix; template void GRUUnitCompute::Run() { +#ifndef WIN32 auto& param = this->Param(); auto& context = ctx_->As(); auto* input = param.input; @@ -121,6 +122,11 @@ void GRUUnitCompute::Run() { } else { h.device(place) = u * (c - h_p) + h_p; // u * c + (1 - u) * h_p } +#else + LOG(FATAL) << "Error: this model is not supported on Windows Os yet, because " + "gru_unit kernel is not supported on Windows Paddle-Lite, " + "please update your Paddle-Lite version."; +#endif } } // namespace x86