提交 49913fa4 编写于 作者: alinag's avatar alinag

add define function

test=develop
上级 c210374c
...@@ -25,11 +25,6 @@ namespace kernels { ...@@ -25,11 +25,6 @@ namespace kernels {
namespace x86 { namespace x86 {
struct SumFunctor { struct SumFunctor {
template <typename X, typename Y, typename Dim>
void operator()(X* x, Y* y, const Dim& dim) {
y->device(lite::fluid::EigenDeviceType<TARGET(kX86)>()) = x->sum(dim);
}
template <typename X, typename Y, typename Dim> template <typename X, typename Y, typename Dim>
void operator()(X* x, Y* y, const Dim& dim, size_t d, size_t r_d) { void operator()(X* x, Y* y, const Dim& dim, size_t d, size_t r_d) {
for (int i = 0; i < dim[0]; i++) { for (int i = 0; i < dim[0]; i++) {
...@@ -43,8 +38,23 @@ struct SumFunctor { ...@@ -43,8 +38,23 @@ struct SumFunctor {
} }
} }
} }
template <typename X, typename Y, typename Dim>
void operator()(X* x, Y* y, const Dim& dim) {
y->device(lite::fluid::EigenDeviceType<TARGET(kX86)>()) = x->sum(dim);
}
}; };
#define HANDLE_DIMT(NDIM, RDIM) \
if (ndim == NDIM && rdim == RDIM) { \
paddle::lite::kernels::x86::ReduceFunctorTensor<lite::TargetType::kX86, \
T, \
NDIM, \
RDIM, \
SumFunctor>( \
*input, output, dims, keep_dim); \
}
#define HANDLE_DIM(NDIM, RDIM) \ #define HANDLE_DIM(NDIM, RDIM) \
if (ndim == NDIM && rdim == RDIM) { \ if (ndim == NDIM && rdim == RDIM) { \
paddle::lite::kernels::x86:: \ paddle::lite::kernels::x86:: \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册