aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Shahid <shahid@us.ibm.com>2017-12-27 00:50:54 +0530
committerGravatar drpngx <drpngx@users.noreply.github.com>2017-12-26 11:20:54 -0800
commitced991d65a95ebbdd57c2e0670d88563042a3180 (patch)
tree418622b68b0bb089427ea594db28f10b6805e913
parent6b6674a512e144dd791f2bdbed930be6cdc67788 (diff)
Update C API test data comparison for s390x (#15390)
* Correct the AppendHash test data comparison for s390x * Correct _USE_C_API test data comparison for s390x * Correcting the Python coding style (pylint) Correcting the following comment issued by pylint: C: 25, 0: standard import "import platform" should be placed before "import numpy as np" (wrong-import-order) * Correcting code to conform to Google C++ Style Guide Correcting as per the changes suggested by "clang-format". * Making the changes generic for all big endian architectures Changes made as per review comment: https://github.com/tensorflow/tensorflow/pull/15390#pullrequestreview-84306138 * Making the changes generic for all big endian architectures Changes made as per review comment: https://github.com/tensorflow/tensorflow/pull/15390#discussion_r157631673 * Correcting code to conform to Google C++ Style Guide
-rw-r--r--tensorflow/c/c_api_function_test.cc4
-rw-r--r--tensorflow/python/framework/function_test.py9
2 files changed, 11 insertions, 2 deletions
diff --git a/tensorflow/c/c_api_function_test.cc b/tensorflow/c/c_api_function_test.cc
index 2e2293ca85..6234372fe3 100644
--- a/tensorflow/c/c_api_function_test.cc
+++ b/tensorflow/c/c_api_function_test.cc
@@ -1462,7 +1462,11 @@ TEST_F(CApiFunctionTest, AppendHash) {
/*append_hash=*/true);
tensorflow::FunctionDef fdef;
ASSERT_TRUE(GetFunctionDef(func_, &fdef));
+#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+ ASSERT_EQ(string("func_name_base_ZpgUD4x8oqk"), fdef.signature().name());
+#else
ASSERT_EQ(string("func_name_base_qaJ8jA8UmGY"), fdef.signature().name());
+#endif
}
TEST_F(CApiFunctionTest, GetOpDef) {
diff --git a/tensorflow/python/framework/function_test.py b/tensorflow/python/framework/function_test.py
index f5a97eb197..cbe1a33ed0 100644
--- a/tensorflow/python/framework/function_test.py
+++ b/tensorflow/python/framework/function_test.py
@@ -20,6 +20,7 @@ from __future__ import print_function
import re
import time
+import sys
import numpy as np
@@ -765,8 +766,12 @@ class FunctionTest(test.TestCase):
# We added more randomness to function names in C API.
# TODO(iga): Remove this if statement when we switch to C API.
if ops._USE_C_API: # pylint: disable=protected-access
- self.assertEqual("Foo_aCYSbwBkR5A",
- Foo.instantiate([dtypes.float32] * 3).name)
+ if sys.byteorder == 'big':
+ self.assertEqual("Foo_kEdkAG8SJvg",
+ Foo.instantiate([dtypes.float32] * 3).name)
+ else:
+ self.assertEqual("Foo_aCYSbwBkR5A",
+ Foo.instantiate([dtypes.float32] * 3).name)
else:
self.assertEqual("Foo_d643acf7",
Foo.instantiate([dtypes.float32] * 3).name)