From d8fac4cb80eb0c42d2550bcb720a80d29fc5f22d Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 14 May 2018 17:58:36 -0700 Subject: [PATCH] Add tf.regex_match for regex match support (#19160) * Add tf.regex_match for regex match support This fix tries to address the issue raised in 18264. Currently tf.regex_replace has already been supported though there was no regex match support. This fix adds the tf.regex_match support in a similiar pattern as tf.regex_replace. This fix fixes 18264. Signed-off-by: Yong Tang * Update BUILD file for the tf.regex_match kernel Signed-off-by: Yong Tang * Register RegexMatch ops Signed-off-by: Yong Tang * Add test cases for tf.regex_match Signed-off-by: Yong Tang * Update api_defs Signed-off-by: Yong Tang * Update API golden update with: ``` bazel-bin/tensorflow/tools/api/tests/api_compatibility_test --update_goldens True ``` Signed-off-by: Yong Tang * Expose regex_full_match in tf.strings namespace Signed-off-by: Yong Tang * Update golden API ``` bazel-bin/tensorflow/tools/api/tests/api_compatibility_test --update_goldens True ``` Signed-off-by: Yong Tang --- .../api_def/base_api/api_def_RegexFullMatch.pbtxt | 30 +++++++++++ .../python_api/api_def_RegexFullMatch.pbtxt | 4 ++ tensorflow/core/kernels/BUILD | 7 +++ tensorflow/core/kernels/regex_full_match_op.cc | 59 ++++++++++++++++++++++ tensorflow/core/ops/string_ops.cc | 11 ++++ tensorflow/python/kernel_tests/BUILD | 12 +++++ .../kernel_tests/regex_full_match_op_test.py | 54 ++++++++++++++++++++ tensorflow/python/ops/string_ops.py | 2 + tensorflow/tools/api/generator/BUILD | 1 + tensorflow/tools/api/golden/tensorflow.pbtxt | 4 ++ .../tools/api/golden/tensorflow.strings.pbtxt | 7 +++ 11 files changed, 191 insertions(+) create mode 100644 tensorflow/core/api_def/base_api/api_def_RegexFullMatch.pbtxt create mode 100644 tensorflow/core/api_def/python_api/api_def_RegexFullMatch.pbtxt create mode 100644 tensorflow/core/kernels/regex_full_match_op.cc create mode 100644 tensorflow/python/kernel_tests/regex_full_match_op_test.py create mode 100644 tensorflow/tools/api/golden/tensorflow.strings.pbtxt diff --git a/tensorflow/core/api_def/base_api/api_def_RegexFullMatch.pbtxt b/tensorflow/core/api_def/base_api/api_def_RegexFullMatch.pbtxt new file mode 100644 index 0000000..8cef243 --- /dev/null +++ b/tensorflow/core/api_def/base_api/api_def_RegexFullMatch.pbtxt @@ -0,0 +1,30 @@ +op { + graph_op_name: "RegexFullMatch" + in_arg { + name: "input" + description: <