diff --git a/tensorflow/compiler/tests/image_ops_test.py b/tensorflow/compiler/tests/image_ops_test.py index 34e2c8c8986..28a1dd9ebdb 100644 --- a/tensorflow/compiler/tests/image_ops_test.py +++ b/tensorflow/compiler/tests/image_ops_test.py @@ -560,6 +560,8 @@ class ResizeBilinearTest(parameterized.TestCase, xla_test.XLATestCase): ("72x72To456x456", 72, 72, 456, 456), ("86x86To456x456", 86, 86, 456, 456), ("100x100To456x456", 100, 100, 456, 456), + ("64x64To224x224", 64, 64, 224, 224), + ("224x224To224x224", 224, 224, 224, 224), # This test is disabled because it is very slow. It is slow because # 383 is prime, 383 and 2047 are coprime, and 2048 is large. # ("Disabled_384x72To2048x384", 384, 72, 2048, 384), diff --git a/tensorflow/compiler/tf2xla/kernels/image_resize_ops.cc b/tensorflow/compiler/tf2xla/kernels/image_resize_ops.cc index 9ee17d1aa9c..aaa322eef87 100644 --- a/tensorflow/compiler/tf2xla/kernels/image_resize_ops.cc +++ b/tensorflow/compiler/tf2xla/kernels/image_resize_ops.cc @@ -312,8 +312,11 @@ xla::XlaOp ResizeUsingDilationAndConvolution( } // Split convolutions into independent dimensions if they would be a very - // large kernel. - if (dims.kernel_size[0] * dims.kernel_size[1] < kMax2DKernelSize) { + // large kernel or if one or more of the dimensions are already equal. + bool decompose_resize = + in_size[0] == out_size[0] || in_size[1] == out_size[1] || + dims.kernel_size[0] * dims.kernel_size[1] >= kMax2DKernelSize; + if (!decompose_resize) { xla::XlaOp kernel = MakeGeneralResizeKernel(builder, type, dims.kernel_size, channels, is_kernel_bilinear); output =