From cd65cb746fa3fe076bb7d97898b721bced6f2b47 Mon Sep 17 00:00:00 2001 From: lijianshe02 Date: Tue, 22 Oct 2019 09:38:11 +0000 Subject: [PATCH] add asr related kernel test=develop --- lite/fluid/eigen.h | 4 ++-- lite/kernels/x86/reduce_compute.h | 2 +- lite/kernels/x86/reduce_op_function.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lite/fluid/eigen.h b/lite/fluid/eigen.h index 4314a6c492..eac5332b53 100644 --- a/lite/fluid/eigen.h +++ b/lite/fluid/eigen.h @@ -118,8 +118,8 @@ struct EigenScalar { using ConstType = Eigen::TensorMap< Eigen::TensorFixedSize, MajorType, IndexType>>; - static Type From(const Tensor& tensor) { - return Type(const_cast(tensor.data())); + static Type From(Tensor* tensor) { + return Type(const_cast(tensor->data())); } // NOLINT static ConstType From(const Tensor& tensor) { diff --git a/lite/kernels/x86/reduce_compute.h b/lite/kernels/x86/reduce_compute.h index faace5e24e..655f104ce6 100644 --- a/lite/kernels/x86/reduce_compute.h +++ b/lite/kernels/x86/reduce_compute.h @@ -56,7 +56,7 @@ class ReduceSumCompute : public KernelLite { if (reduce_all) { // Flatten and reduce 1-D tensor auto x = lite::fluid::EigenVector::Flatten(*input); - auto out = lite::fluid::EigenScalar::From(*output); + auto out = lite::fluid::EigenScalar::From(output); // auto& place = *platform::CPUDeviceContext().eigen_device(); auto reduce_dim = Eigen::array({{0}}); SumFunctor functor; diff --git a/lite/kernels/x86/reduce_op_function.h b/lite/kernels/x86/reduce_op_function.h index be3ef6ed0d..b3ddab64e4 100644 --- a/lite/kernels/x86/reduce_op_function.h +++ b/lite/kernels/x86/reduce_op_function.h @@ -70,7 +70,7 @@ void ReduceFunctor(const lite::Tensor& input, Functor functor; if (D == 1) { - auto out = EigenScalar::From(*output); + auto out = EigenScalar::From(output); functor(&x, &out, reduce_dim); } else { auto out = EigenTensor::From(*output, out_dims); -- GitLab