[TF:XLA] make miscomparison error messages more readable
authorNick Desaulniers <ndesaulniers@google.com>
Tue, 22 May 2018 21:08:57 +0000 (14:08 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Tue, 22 May 2018 21:11:48 +0000 (14:11 -0700)
PiperOrigin-RevId: 197620560

tensorflow/compiler/xla/literal_comparison.cc

index 3696fdb..bf9679c 100644 (file)
@@ -716,9 +716,11 @@ Status Equal(const LiteralSlice& expected, const LiteralSlice& actual) {
   }
 
   return AppendStatus(result,
-                      tensorflow::strings::Printf("expected: %s\nactual:   %s",
-                                                  expected.ToString().c_str(),
-                                                  actual.ToString().c_str()));
+                      tensorflow::strings::Printf(
+                          "\nat index: %s\nexpected: %s\nactual:   %s",
+                          Literal::MultiIndexAsString(multi_index).c_str(),
+                          ToStringTruncated(expected).c_str(),
+                          ToStringTruncated(actual).c_str()));
 }
 
 Status Near(const LiteralSlice& expected, const LiteralSlice& actual,