From ca5952670d98b568fa4ac671cf2310d78474c525 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 6 Sep 2018 11:03:14 -0700 Subject: [PATCH] Add StaticRegexFullMatch which can be used in place of RegexFullMatch when the regex pattern are fixed. This allows the Op to perform the expensive regex compilation once upon creation instead of with each call to compute. RELNOTES: Performance improvements for regex full match operations. PiperOrigin-RevId: 211835278 --- .../api_def_StaticRegexFullMatch.pbtxt | 29 +++++++++ .../core/kernels/regex_full_match_op.cc | 33 ++++++++++ tensorflow/core/ops/string_ops.cc | 6 ++ tensorflow/python/kernel_tests/BUILD | 1 + .../kernel_tests/regex_full_match_op_test.py | 60 +++++++++++++++---- tensorflow/python/ops/string_ops.py | 34 ++++++++++- 6 files changed, 151 insertions(+), 12 deletions(-) create mode 100644 tensorflow/core/api_def/base_api/api_def_StaticRegexFullMatch.pbtxt diff --git a/tensorflow/core/api_def/base_api/api_def_StaticRegexFullMatch.pbtxt b/tensorflow/core/api_def/base_api/api_def_StaticRegexFullMatch.pbtxt new file mode 100644 index 00000000000..6d9d9908ca2 --- /dev/null +++ b/tensorflow/core/api_def/base_api/api_def_StaticRegexFullMatch.pbtxt @@ -0,0 +1,29 @@ +op { + graph_op_name: "StaticRegexFullMatch" + in_arg { + name: "input" + description: <