PR #39548: [INTEL MKL] Fix conv_ops_test and remapper_test
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/39548
Fix two C++ test failures related to MKL ops.
1. conv_ops_test // MklConvOp does not support EXPLICIT padding
2. remapper_test // Fusion of MKL Conv and Mkl FusedBatchNorm is not supported
The fix is to disable the related tests with MKL build.
Copybara import of the project:
--
5d92849778771a475fe339d2954db12c3d4ecc2b by Guozhong Zhu...
***
PiperOrigin-RevId: 312742653
Change-Id: I0393c00589c3d2bc04965e390c2b2ba249da0432
diff --git a/tensorflow/core/grappler/optimizers/remapper_test.cc b/tensorflow/core/grappler/optimizers/remapper_test.cc
index 1946b86..35e09b2 100644
--- a/tensorflow/core/grappler/optimizers/remapper_test.cc
+++ b/tensorflow/core/grappler/optimizers/remapper_test.cc
@@ -607,7 +607,6 @@
}
}
-#ifndef INTEL_MKL
TEST_F(RemapperTest, FuseConv2DWithBatchNorm) {
using ops::Placeholder;
@@ -851,7 +850,6 @@
ASSERT_EQ(tensors.size(), 1);
test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6);
}
-#endif
} // namespace grappler
} // namespace tensorflow
diff --git a/tensorflow/core/kernels/conv_ops_test.cc b/tensorflow/core/kernels/conv_ops_test.cc
index 308ec40..21dffa3 100644
--- a/tensorflow/core/kernels/conv_ops_test.cc
+++ b/tensorflow/core/kernels/conv_ops_test.cc
@@ -1028,14 +1028,12 @@
this->VerifyConv2DWithBias(filter_size, filter_count);
}
-#ifndef INTEL_MKL
TYPED_TEST_P(FusedConv2DWithBiasOpTest, ExplicitPaddingConvolution) {
const int filter_size = 3;
const int filter_count = 12;
this->VerifyConv2DWithBias(filter_size, filter_count,
/*explicit_paddings=*/{0, 0, 1, 2, 3, 4, 0, 0});
}
-#endif
TYPED_TEST_P(FusedConv2DWithBiasOpTest, OneByOneConvolutionAndActivation) {
const int filter_size = 1;
@@ -1064,7 +1062,6 @@
}
}
-#ifndef INTEL_MKL
TYPED_TEST_P(FusedConv2DWithBiasOpTest,
ExplicitPaddingConvolutionAndActivation) {
const int filter_size = 3;
@@ -1075,7 +1072,6 @@
/*explicit_paddings=*/{0, 0, 1, 2, 3, 4, 0, 0});
}
}
-#endif
// -------------------------------------------------------------------------- //
// Conv2D + FusedBatchNorm + {Activation} //
@@ -1099,7 +1095,6 @@
this->VerifyConv2DWithBatchNorm(filter_size, filter_count);
}
-#ifndef INTEL_MKL
TYPED_TEST_P(FusedConv2DWithBatchNormOpTest, ExplicitPaddingConvolution) {
const int filter_size = 3;
const int filter_count = 12;
@@ -1107,7 +1102,6 @@
filter_size, filter_count,
/*explicit_paddings=*/{0, 0, 1, 2, 3, 4, 0, 0});
}
-#endif
TYPED_TEST_P(FusedConv2DWithBatchNormOpTest, OneByOneConvolutionAndActivation) {
const int filter_size = 1;
@@ -1137,7 +1131,6 @@
}
}
-#ifndef INTEL_MKL
TYPED_TEST_P(FusedConv2DWithBatchNormOpTest,
ExplicitPaddingConvolutionAndActivation) {
const int filter_size = 3;
@@ -1148,49 +1141,34 @@
/*explicit_paddings=*/{0, 0, 1, 2, 3, 4, 0, 0});
}
}
-#endif
-REGISTER_TYPED_TEST_SUITE_P(FusedConv2DWithBiasOpTest, //
- OneByOneConvolution, //
- ImageSizeConvolution, //
- SpatialConvolution, //
-#ifndef INTEL_MKL
- ExplicitPaddingConvolution, //
-#endif
+REGISTER_TYPED_TEST_SUITE_P(FusedConv2DWithBiasOpTest, //
+ OneByOneConvolution, //
+ ImageSizeConvolution, //
+ SpatialConvolution, //
+ ExplicitPaddingConvolution, //
OneByOneConvolutionAndActivation, //
ImageSizeConvolutionAndActivation, //
-#ifndef INTEL_MKL
- SpatialConvolutionAndActivation, //
+ SpatialConvolutionAndActivation, //
ExplicitPaddingConvolutionAndActivation);
-#else
- SpatialConvolutionAndActivation);
-#endif
-REGISTER_TYPED_TEST_SUITE_P(FusedConv2DWithBatchNormOpTest, //
- OneByOneConvolution, //
- ImageSizeConvolution, //
- SpatialConvolution, //
-#ifndef INTEL_MKL
- ExplicitPaddingConvolution, //
-#endif
+REGISTER_TYPED_TEST_SUITE_P(FusedConv2DWithBatchNormOpTest, //
+ OneByOneConvolution, //
+ ImageSizeConvolution, //
+ SpatialConvolution, //
+ ExplicitPaddingConvolution, //
OneByOneConvolutionAndActivation, //
ImageSizeConvolutionAndActivation, //
-#ifndef INTEL_MKL
- SpatialConvolutionAndActivation, //
+ SpatialConvolutionAndActivation, //
ExplicitPaddingConvolutionAndActivation);
-#else
- SpatialConvolutionAndActivation);
-#endif
using FusedBiasAddDataTypes = ::testing::Types<float, double>;
INSTANTIATE_TYPED_TEST_SUITE_P(Test, FusedConv2DWithBiasOpTest,
FusedBiasAddDataTypes);
-#ifndef INTEL_MKL
using FusedBatchNormDataTypes = ::testing::Types<float>;
INSTANTIATE_TYPED_TEST_SUITE_P(Test, FusedConv2DWithBatchNormOpTest,
FusedBatchNormDataTypes);
-#endif
#endif // TENSORFLOW_USE_ROCM
} // namespace tensorflow