From d9d45ba77a601c4c980eb941e20f7d6f317673c1 Mon Sep 17 00:00:00 2001 From: jakpiase <62569058+jakpiase@users.noreply.github.com> Date: Tue, 13 Jul 2021 04:36:24 +0200 Subject: [PATCH] Added printing tensor's format if oneDNN is used (#34021) * added printing tensor's format * added suggested changes --- paddle/fluid/framework/tensor_util.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paddle/fluid/framework/tensor_util.cc b/paddle/fluid/framework/tensor_util.cc index 7cd62e3e2a7..d2616da7a12 100644 --- a/paddle/fluid/framework/tensor_util.cc +++ b/paddle/fluid/framework/tensor_util.cc @@ -24,6 +24,9 @@ limitations under the License. */ #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/platform/complex.h" #include "paddle/fluid/platform/profiler.h" +#ifdef PADDLE_WITH_MKLDNN +#include "dnnl_debug.h" +#endif namespace paddle { namespace framework { @@ -1177,6 +1180,11 @@ std::ostream& operator<<(std::ostream& os, const Tensor& t) { os << " - shape: [" << t.dims() << "]\n"; os << " - layout: " << DataLayoutToString(t.layout()) << "\n"; +#ifdef PADDLE_WITH_MKLDNN + os << " - format: " + << dnnl_fmt_tag2str(static_cast(t.format())) << "\n"; +#endif + Tensor tensor; tensor.Resize(t.dims()); if (platform::is_cpu_place(t.place())) { -- GitLab