From 5887cc10e7eca69872364fc8551d15e66d045b08 Mon Sep 17 00:00:00 2001
From: Kay Zhu <kayzhu@google.com>
Date: Mon, 31 Jul 2017 12:36:40 -0700
Subject: [PATCH] [XLA] In LiteralUtil::StridedConfig: choose the larger
 dimension between the source and destination shapes' minor-most dimension
 index.

PiperOrigin-RevId: 163732014
---
 tensorflow/compiler/xla/literal_util.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tensorflow/compiler/xla/literal_util.cc b/tensorflow/compiler/xla/literal_util.cc
index 0db9bd757d4..25d94017338 100644
--- a/tensorflow/compiler/xla/literal_util.cc
+++ b/tensorflow/compiler/xla/literal_util.cc
@@ -43,10 +43,10 @@ Literal::StrideConfig::StrideConfig(
       base(dimensions.size(), 0),
       step(dimensions.size(), 1) {
   if (!dimensions.empty()) {
-    // Selects the shape with the highest minor dimension as the one upon
-    // where to run the tight stride loop.
-    if (source_shape.layout().minor_to_major()[0] >=
-        dest_shape.layout().minor_to_major()[0]) {
+    // Selects the shape with the largest minor dimension as the one upon
+    // which to run the tight stride loop.
+    if (dimensions[source_shape.layout().minor_to_major()[0]] >=
+        dimensions[dest_shape.layout().minor_to_major()[0]]) {
       minor_dimension = source_shape.layout().minor_to_major()[0];
       dest_stride = IndexUtil::GetDimensionStride(dest_shape, minor_dimension);
     } else {