提交 cd65cb74 编写于 作者: L lijianshe02

add asr related kernel test=develop

上级 d5e58a98
...@@ -118,8 +118,8 @@ struct EigenScalar { ...@@ -118,8 +118,8 @@ struct EigenScalar {
using ConstType = Eigen::TensorMap< using ConstType = Eigen::TensorMap<
Eigen::TensorFixedSize<const T, Eigen::Sizes<>, MajorType, IndexType>>; Eigen::TensorFixedSize<const T, Eigen::Sizes<>, MajorType, IndexType>>;
static Type From(const Tensor& tensor) { static Type From(Tensor* tensor) {
return Type(const_cast<T*>(tensor.data<T>())); return Type(const_cast<T*>(tensor->data<T>()));
} // NOLINT } // NOLINT
static ConstType From(const Tensor& tensor) { static ConstType From(const Tensor& tensor) {
......
...@@ -56,7 +56,7 @@ class ReduceSumCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> { ...@@ -56,7 +56,7 @@ class ReduceSumCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> {
if (reduce_all) { if (reduce_all) {
// Flatten and reduce 1-D tensor // Flatten and reduce 1-D tensor
auto x = lite::fluid::EigenVector<T>::Flatten(*input); auto x = lite::fluid::EigenVector<T>::Flatten(*input);
auto out = lite::fluid::EigenScalar<T>::From(*output); auto out = lite::fluid::EigenScalar<T>::From(output);
// auto& place = *platform::CPUDeviceContext().eigen_device(); // auto& place = *platform::CPUDeviceContext().eigen_device();
auto reduce_dim = Eigen::array<int, 1>({{0}}); auto reduce_dim = Eigen::array<int, 1>({{0}});
SumFunctor functor; SumFunctor functor;
......
...@@ -70,7 +70,7 @@ void ReduceFunctor(const lite::Tensor& input, ...@@ -70,7 +70,7 @@ void ReduceFunctor(const lite::Tensor& input,
Functor functor; Functor functor;
if (D == 1) { if (D == 1) {
auto out = EigenScalar<T>::From(*output); auto out = EigenScalar<T>::From(output);
functor(&x, &out, reduce_dim); functor(&x, &out, reduce_dim);
} else { } else {
auto out = EigenTensor<T, (D - R_D)>::From(*output, out_dims); auto out = EigenTensor<T, (D - R_D)>::From(*output, out_dims);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册