From 0805612d426ae8cf122aa880299411ebe0daadb2 Mon Sep 17 00:00:00 2001 From: Srinivasan Narayanamoorthy Date: Fri, 24 Apr 2020 16:34:29 -0700 Subject: [PATCH] remapper test fix. --- tensorflow/core/grappler/optimizers/remapper.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tensorflow/core/grappler/optimizers/remapper.cc b/tensorflow/core/grappler/optimizers/remapper.cc index c9cce4daca1..9602ea44f0d 100644 --- a/tensorflow/core/grappler/optimizers/remapper.cc +++ b/tensorflow/core/grappler/optimizers/remapper.cc @@ -219,19 +219,22 @@ bool HasDataType(const NodeDef* node, const DataType& expected, bool IsCpuCompatibleDataType(const NodeDef* contraction, const string& type_attr = "T") { DataType dtype = GetDataTypeFromAttr(*contraction, type_attr); -#if defined(INTEL_MKL) && defined(ENABLE_INTEL_MKL_BFLOAT16) - if (IsConv2D(*contraction)) { - return dtype == DT_FLOAT || dtype == DT_BFLOAT16; - } else if (IsDepthwiseConv2dNative(*contraction)) { - return dtype == DT_FLOAT || dtype == DT_BFLOAT16; - } else if (IsMatMul(*contraction)) { +#if defined(INTEL_MKL) +#if defined(ENABLE_INTEL_MKL_BFLOAT16) + if (IsConv2D(*contraction) || IsDepthwiseConv2dNative(*contraction) || + IsMatMul(*contraction)) { return dtype == DT_FLOAT || dtype == DT_BFLOAT16; +#else + if (IsConv2D(*contraction) || IsDepthwiseConv2dNative(*contraction) || + IsMatMul(*contraction)) { + return dtype == DT_FLOAT; +#endif // ENABLE_INTEL_MKL_BFLOAT16 #else if (IsConv2D(*contraction)) { return dtype == DT_FLOAT || dtype == DT_DOUBLE; } else if (IsMatMul(*contraction)) { return dtype == DT_FLOAT; -#endif // INTEL_MKL && ENABLE_INTEL_MKL_BFLOAT16 +#endif // INTEL_MKL } else { return false; }