From b367122a94b2aef00ad695141bf1bb6765ed7cf5 Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Wed, 5 Oct 2022 15:20:44 +0200 Subject: [PATCH] - compilation fix --- paddle/fluid/framework/tensor_util.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/tensor_util.cc b/paddle/fluid/framework/tensor_util.cc index 80f6d7a66e..0e102a7915 100644 --- a/paddle/fluid/framework/tensor_util.cc +++ b/paddle/fluid/framework/tensor_util.cc @@ -1205,8 +1205,21 @@ std::ostream& operator<<(std::ostream& os, const phi::DenseTensor& t) { << "\n"; #ifdef PADDLE_WITH_MKLDNN +auto represent_mem_desc = [&](const dnnl::memory:desc &md) +{ + auto vec = md.strides; + if (vec.empty()) { + return std::string(); + } + + return std::accumulate(vec.begin() + 1, vec.end(), std::to_string(vec[0]), + [](const std::string& a, T b){ + return a + ", " + std::to_string(b); + }); +} + os << " - memory desc: " - << (t.mem_desc()) << "\n"; + << (represent_mem_desc(t.mem_desc())) << "\n"; #endif DenseTensor tensor; -- GitLab