aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-12-15 11:52:01 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-12-15 12:01:21 -0800
commitfbb5392a65ebaeca19f95cb13fca9166bb5ba3ce (patch)
treef899894e3e285c24ecafb01f822ad53e747ea373
parent8d3690c5649fb6dac481e15eda365e73aeaab84a (diff)
Merged commit includes the following changes:
179221620 by akshayka: Internal cleanup: Delete extraneous print statement in test case. -- 179220917 by A. Unique TensorFlower: [XLA:JF] Make HLO parser recognize negative padding. -- PiperOrigin-RevId: 179221620
-rw-r--r--tensorflow/compiler/xla/BUILD6
-rw-r--r--tensorflow/compiler/xla/python/BUILD4
-rw-r--r--tensorflow/compiler/xla/python/local_computation_builder.i2
-rw-r--r--tensorflow/compiler/xla/python/xla_client_test.py6
-rw-r--r--tensorflow/compiler/xla/tools/parser/hlo_lexer.cc5
-rw-r--r--tensorflow/compiler/xla/tools/parser/hlo_parser_test.cc13
-rw-r--r--tensorflow/python/framework/ops_test.py1
7 files changed, 29 insertions, 8 deletions
diff --git a/tensorflow/compiler/xla/BUILD b/tensorflow/compiler/xla/BUILD
index cd69c69889..be0dd0bc82 100644
--- a/tensorflow/compiler/xla/BUILD
+++ b/tensorflow/compiler/xla/BUILD
@@ -641,6 +641,12 @@ filegroup(
visibility = ["//tensorflow:__subpackages__"],
)
+py_proto_library(
+ name = "xla_data_proto_py_pb2",
+ api_version = 2,
+ deps = [":xla_data_proto"],
+)
+
# This is a headers target that extra XLA devices can use to prevent circular dependencies. Devices that are compiled as separate shared objects can also use it to prevent linking of library code.
cc_header_only_library(
name = "xla_headers_lib",
diff --git a/tensorflow/compiler/xla/python/BUILD b/tensorflow/compiler/xla/python/BUILD
index a6b8158671..7734e55967 100644
--- a/tensorflow/compiler/xla/python/BUILD
+++ b/tensorflow/compiler/xla/python/BUILD
@@ -11,7 +11,7 @@ py_library(
visibility = ["//visibility:public"],
deps = [
":pywrap_xla",
- "//tensorflow/compiler/xla:xla_data_proto_py",
+ "//tensorflow/compiler/xla:xla_data_proto_py_pb2",
],
)
@@ -23,6 +23,7 @@ py_test(
deps = [
":xla_client",
"//tensorflow/python:platform_test",
+ "//third_party/py/numpy",
],
)
@@ -51,6 +52,7 @@ cc_library(
"//tensorflow/compiler/xla/client:local_client",
"//tensorflow/compiler/xla/service:cpu_plugin",
"//tensorflow/core:lib",
+ "//tensorflow/stream_executor/host:host_platform",
],
)
diff --git a/tensorflow/compiler/xla/python/local_computation_builder.i b/tensorflow/compiler/xla/python/local_computation_builder.i
index ac8f3e4277..678de3e762 100644
--- a/tensorflow/compiler/xla/python/local_computation_builder.i
+++ b/tensorflow/compiler/xla/python/local_computation_builder.i
@@ -106,7 +106,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/shape_util.h"
-#include "tensorflow/compiler/xla/xla_data.pb.h"
+#include "tensorflow/compiler/xla/xla_data.proto.h"
#include "tensorflow/core/lib/gtl/array_slice.h"
#include "tensorflow/compiler/xla/python/numpy_bridge.h"
#include "tensorflow/compiler/xla/python/local_computation_builder.h"
diff --git a/tensorflow/compiler/xla/python/xla_client_test.py b/tensorflow/compiler/xla/python/xla_client_test.py
index 878cd83edc..cf71212fdb 100644
--- a/tensorflow/compiler/xla/python/xla_client_test.py
+++ b/tensorflow/compiler/xla/python/xla_client_test.py
@@ -23,10 +23,10 @@ import itertools
import numpy as np
from tensorflow.compiler.xla.python import xla_client
-import unittest
+from tensorflow.python.platform import googletest
-class LocalComputationTest(unittest.TestCase):
+class LocalComputationTest(googletest.TestCase):
"""Base class for running an XLA Computation through the local client."""
def _NewComputation(self, name=None):
@@ -895,4 +895,4 @@ class EmbeddedComputationsTest(LocalComputationTest):
if __name__ == "__main__":
- unittest.main()
+ googletest.main()
diff --git a/tensorflow/compiler/xla/tools/parser/hlo_lexer.cc b/tensorflow/compiler/xla/tools/parser/hlo_lexer.cc
index 459d511e90..6d1e4173d2 100644
--- a/tensorflow/compiler/xla/tools/parser/hlo_lexer.cc
+++ b/tensorflow/compiler/xla/tools/parser/hlo_lexer.cc
@@ -257,7 +257,8 @@ TokKind HloLexer::LexPercent() {
// fp without exp ::= [-]?([0-9]+[.][0-9]*|[0-9]*[.][0-9]+)
// dim_labels_pattern ::= [0-9bf]{2,}_[0-9io]{2,}->[0-9bf]{2,}
// dxd_pattern ::= [0-9]+(x[0-9]+)+
-// pad_pattern ::= [0-9]+_[0-9]+(_[0-9]+)?(x[0-9]+_[0-9]+(_[0-9]+)?)*
+// pad_pattern ::=
+// [-]?[0-9]+_[-]?[0-9]+(_[0-9]+)?(x[-]?[0-9]+_[-]?[0-9]+(_[0-9]+)?)*
// int ::= [-]?[0-9]+
// negative inf ::= '-inf'
TokKind HloLexer::LexNumberOrPattern() {
@@ -275,7 +276,7 @@ TokKind HloLexer::LexNumberOrPattern() {
R"([0-9bf]{2,}_[0-9io]{2,}->[0-9bf]{2,})"};
static LazyRE2 dxd_pattern = {R"([0-9]+(x[0-9]+)+)"};
static LazyRE2 pad_pattern = {
- R"([0-9]+_[0-9]+(_[0-9]+)?(x[0-9]+_[0-9]+(_[0-9]+)?)*)"};
+ R"([-]?[0-9]+_[-]?[0-9]+(_[0-9]+)?(x[-]?[0-9]+_[-]?[0-9]+(_[0-9]+)?)*)"};
if (RE2::Consume(&consumable, *dim_labels_pattern)) {
current_ptr_ = consumable.begin();
diff --git a/tensorflow/compiler/xla/tools/parser/hlo_parser_test.cc b/tensorflow/compiler/xla/tools/parser/hlo_parser_test.cc
index 8b6b855218..74a0e35839 100644
--- a/tensorflow/compiler/xla/tools/parser/hlo_parser_test.cc
+++ b/tensorflow/compiler/xla/tools/parser/hlo_parser_test.cc
@@ -608,6 +608,19 @@ ENTRY %PadHasInterior.v3 (input: f32[1,25,7,7]) -> f32[1,25,17,11] {
)"
},
+// Negative padding
+{
+"PadHasNegativePadding",
+R"(HloModule PadHasNegativePadding_module
+
+ENTRY %PadHasNegativePadding (input: f32[1,25,7,7,10]) -> f32[1,15,6,3,29] {
+ %input = f32[1,25,7,7,10]{4,3,2,1,0} parameter(0)
+ %constant = f32[] constant(-5.123)
+ ROOT %pad = f32[1,15,6,3,29]{4,3,2,1,0} pad(f32[1,25,7,7,10]{4,3,2,1,0} %input, f32[] %constant), padding=0_0_0x0_-10_0x0_-1_0x-2_-2_0x-1_-1_3
+}
+
+)"
+},
// fusion
{
"Fusion",
diff --git a/tensorflow/python/framework/ops_test.py b/tensorflow/python/framework/ops_test.py
index 92d42c1807..e327e22f30 100644
--- a/tensorflow/python/framework/ops_test.py
+++ b/tensorflow/python/framework/ops_test.py
@@ -2182,7 +2182,6 @@ class AttrScopeTest(test_util.TensorFlowTestCase):
b = compat.as_text(x.get_attr("_B"))
except ValueError:
b = None
- print(a, b)
return (a, b)
def testNoLabel(self):