Skip to content

Commit

Permalink
[Windows] Fix windows compiling error (#6092)
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyIsFunny authored May 15, 2021
1 parent e62598b commit 306d09d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
7 changes: 4 additions & 3 deletions lite/backends/x86/math/sequence_pooling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,10 @@ class SequencePoolGradFunctor<TARGET(kX86), T> {
};

template class SequencePoolFunctor<TARGET(kX86), float>;
template class SequencePoolFunctor<TARGET(kX86), double>;
template class SequencePoolGradFunctor<TARGET(kX86), float>;
template class SequencePoolGradFunctor<TARGET(kX86), double>;
// Note: these implementations have not been called yet
// Template class SequencePoolFunctor<TARGET(kX86), double>;
// Template class SequencePoolGradFunctor<TARGET(kX86), float>;
// Template class SequencePoolGradFunctor<TARGET(kX86), double>;

} // namespace math
} // namespace x86
Expand Down
11 changes: 6 additions & 5 deletions lite/backends/x86/math/softmax.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ namespace x86 {
namespace math {

template class SoftmaxFunctor<lite::TargetType::kX86, float, true>;
template class SoftmaxFunctor<lite::TargetType::kX86, float, false>;
template class SoftmaxFunctor<lite::TargetType::kX86, double, true>;
template class SoftmaxFunctor<lite::TargetType::kX86, double, false>;
template class SoftmaxGradFunctor<lite::TargetType::kX86, float>;
template class SoftmaxGradFunctor<lite::TargetType::kX86, double>;
// note: these implemetaions have not been called yet
// template class SoftmaxFunctor<lite::TargetType::kX86, float, false>;
// template class SoftmaxFunctor<lite::TargetType::kX86, double, true>;
// template class SoftmaxFunctor<lite::TargetType::kX86, double, false>;
// template class SoftmaxGradFunctor<lite::TargetType::kX86, float>;
// template class SoftmaxGradFunctor<lite::TargetType::kX86, double>;

} // namespace math
} // namespace x86
Expand Down
6 changes: 6 additions & 0 deletions lite/kernels/x86/grid_sampler_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ void BilinearInter(const X86Context& ctx,

template <class T>
void GridSamplerCompute<T>::Run() {
#ifndef WIN32
auto& param = this->Param<param_t>();
auto& context = ctx_->As<X86Context>();
auto* input = param.x;
Expand Down Expand Up @@ -328,6 +329,11 @@ void GridSamplerCompute<T>::Run() {
grid_y_t = grid_y_t.round();
GetGridPointValue<T>(*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
Expand Down
6 changes: 6 additions & 0 deletions lite/kernels/x86/gru_unit_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ using EigenMatrix = lite::fluid::EigenMatrix<T, MajorType, IndexType>;

template <class T>
void GRUUnitCompute<T>::Run() {
#ifndef WIN32
auto& param = this->Param<param_t>();
auto& context = ctx_->As<X86Context>();
auto* input = param.input;
Expand Down Expand Up @@ -121,6 +122,11 @@ void GRUUnitCompute<T>::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
Expand Down

0 comments on commit 306d09d

Please sign in to comment.