From 045470cf003b6a46339eb551593e1d5c25dd944e Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Fri, 21 Jul 2017 10:40:07 -0700 Subject: [PATCH] Slight simplification of eigen.h in hope to make it more readable. --- paddle/framework/eigen.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/paddle/framework/eigen.h b/paddle/framework/eigen.h index 2599b295083..5f3358c69b3 100644 --- a/paddle/framework/eigen.h +++ b/paddle/framework/eigen.h @@ -61,25 +61,24 @@ struct EigenTensor { } }; +template +struct EigenMatrix : public EigenTensor {}; + template struct EigenVector : public EigenTensor { - // Flatten is to reshape a Tensor into a one dimension EigenVector - using Parent = EigenTensor; - static typename Parent::Type Flatten(Tensor& tensor) { - return Parent::From(tensor, - make_ddim({static_cast(product(tensor.dims_))})); + // Flatten reshapes a Tensor into an EigenVector. + static typename EigenVector::Type Flatten(Tensor& tensor) { + return EigenVector::From( + tensor, make_ddim({static_cast(product(tensor.dims_))})); } - static typename Parent::ConstType Flatten(const Tensor& tensor) { - return Parent::From(tensor, - make_ddim({static_cast(product(tensor.dims_))})); + static typename EigenVector::ConstType Flatten(const Tensor& tensor) { + return EigenVector::From( + tensor, make_ddim({static_cast(product(tensor.dims_))})); } }; -template -using EigenMatrix = EigenTensor; - } // namespace framework } // namespace paddle -- GitLab