From ee83ce75bf46b9c3da8c3f9689d1f3811aafe577 Mon Sep 17 00:00:00 2001 From: sneaxiy Date: Wed, 26 Dec 2018 07:29:40 +0000 Subject: [PATCH] try to fix py35 compile error test=develop --- paddle/fluid/framework/ddim.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/framework/ddim.h b/paddle/fluid/framework/ddim.h index 123e227dc..f0a42f0f3 100644 --- a/paddle/fluid/framework/ddim.h +++ b/paddle/fluid/framework/ddim.h @@ -60,7 +60,9 @@ class DDim { DDim() : rank_(1) { dim_[0] = 0; } - DDim(const DDim& ddim) { this->CopyFrom(ddim); } + DDim(const DDim& ddim) : rank_(ddim.rank_) { + dynamic_dim_assign(ddim.Get(), dim_.GetMutable(), rank_); + } DDim(const int* d, int n) : rank_(n) { dynamic_dim_assign(d, dim_.GetMutable(), n); @@ -140,13 +142,10 @@ class DDim { return *reinterpret_cast*>(p); } - inline void CopyFrom(const DDim& ddim) { - rank_ = ddim.rank_; - PADDLE_VISIT_DDIM(rank_, - (void)(UnsafeCast() = ddim.UnsafeCast())); + inline DDim& CopyFrom(const DDim& ddim) { + PADDLE_VISIT_DDIM(ddim.rank_, (*this = ddim.UnsafeCast())); } - friend DDim slice_ddim(const DDim& dim, int begin, int end); friend DDim stride(const DDim& ddim); friend DDim stride_numel(const DDim& ddim); -- GitLab