aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/ops/string_ops.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/ops/string_ops.cc')
-rw-r--r--tensorflow/core/ops/string_ops.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/tensorflow/core/ops/string_ops.cc b/tensorflow/core/ops/string_ops.cc
new file mode 100644
index 0000000000..57b471074c
--- /dev/null
+++ b/tensorflow/core/ops/string_ops.cc
@@ -0,0 +1,21 @@
+#include "tensorflow/core/framework/op.h"
+
+namespace tensorflow {
+
+REGISTER_OP("StringToHashBucket")
+ .Input("string_tensor: string")
+ .Output("output: int64")
+ .Attr("num_buckets: int >= 1")
+ .Doc(R"doc(
+Converts each string in the input Tensor to its hash mod by a number of buckets.
+
+The hash function is deterministic on the content of the string within the
+process.
+
+Note that the hash function may change from time to time.
+
+num_buckets: The number of buckets.
+output: A Tensor of the same shape as the input string_tensor.
+)doc");
+
+} // namespace tensorflow